Added UseWithoutDiscloseMaschineList

This commit is contained in:
TheJoKlLa 2022-04-21 01:34:46 +02:00
parent 90fbd0ff1b
commit 8d7957f0f9

View File

@ -9,7 +9,6 @@ using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks; using System.Threading.Tasks;
using static FabAccessAPI.Schema.Machine; using static FabAccessAPI.Schema.Machine;
using static FabAccessAPI.Schema.MachineSystem;
namespace FabAccessAPI_Test namespace FabAccessAPI_Test
{ {
@ -411,6 +410,8 @@ namespace FabAccessAPI_Test
[Order(3)] [Order(3)]
public class Machine_Test public class Machine_Test
{ {
#region SetUp
public async Task ForceFree(string username, string machineID) public async Task ForceFree(string username, string machineID)
{ {
Console.WriteLine("start: " + machineID); Console.WriteLine("start: " + machineID);
@ -451,8 +452,8 @@ namespace FabAccessAPI_Test
await Task.WhenAll(tasks); await Task.WhenAll(tasks);
} }
#endregion
// TODO: Force State before Test
[TestCase("Admin1", "MachineA1")] [TestCase("Admin1", "MachineA1")]
[TestCase("ManagerA1", "MachineA1")] [TestCase("ManagerA1", "MachineA1")]
[TestCase("MakerA1", "MachineA1")] [TestCase("MakerA1", "MachineA1")]
@ -483,5 +484,40 @@ namespace FabAccessAPI_Test
Assert.AreEqual(MachineState.free, machine.State); Assert.AreEqual(MachineState.free, machine.State);
} }
[TestCase("MakerQRA", "MachineA1")]
[Order(1)]
public async Task UseWithoutDiscloseMaschineList(string username, string machineID)
{
Connection connection = await API_TestEnv_Test.Connect(username);
Session session = connection.Session;
MachineSystem.IInfoInterface infoInterface = await session.MachineSystem.Info().ConfigureAwait(false);
Machine machine = await infoInterface.GetMachine(machineID).ConfigureAwait(false);
// Check State before run Test
if (machine.State != MachineState.free)
{
API_TestEnv_Test.Disconnect(connection);
Assert.Inconclusive("State is not 'free'");
}
await machine.Use.Use().ConfigureAwait(false);
IReadOnlyList<Machine> machines = await infoInterface.GetMachineList().ConfigureAwait(false);
if(machines.Count != 1 && machines[0].Id != machineID)
{
Assert.Fail();
}
machine = await infoInterface.GetMachine(machineID).ConfigureAwait(false);
await machine.Inuse.GiveBack().ConfigureAwait(false);
machine = await infoInterface.GetMachine(machineID).ConfigureAwait(false);
API_TestEnv_Test.Disconnect(connection);
Assert.AreEqual(MachineState.free, machine.State);
}
} }
} }