public DeviceSanityCheckSubStateActionTests()
        {
            linkRequest = new LinkRequest()
            {
                //LinkObjects = new LinkRequestIPA5Object
                //{
                //    LinkActionResponseList = new List<XO.Responses.LinkActionResponse>()
                //},
                Actions = new List <LinkActionRequest>()
                {
                    new LinkActionRequest()
                    {
                        MessageID     = RandomGenerator.BuildRandomString(8),
                        Timeout       = 10000,
                        DeviceRequest = new LinkDeviceRequest()
                        {
                            DeviceIdentifier = new LinkDeviceIdentifier()
                            {
                                Manufacturer = "DeviceMockerInc",
                                Model        = "DeviceMokerModel",
                                SerialNumber = "CEEEDEADBEEF"
                            }
                        }
                    }
                }
            };
            //linkRequest.LinkObjects = SampleBuilder.LinkObjectsForEvents();
            //linkRequest.LinkObjects.LinkActionResponseList[0].MessageID = "Authentication";
            //linkRequest.LinkObjects.LinkActionResponseList[0].DeviceResponse.Devices = new List<LinkDeviceResponse>()
            //{
            //    new LinkDeviceResponse()
            //    {
            //        Manufacturer = "NoDevice",
            //        CardWorkflowControls = new LinkCardWorkflowControls()
            //        {
            //            CardCaptureTimeout = 10,
            //            ManualCardTimeout = 5
            //        }
            //    }
            //};

            //mockLoggingClient = new Mock<ILoggingServiceClient>();

            mockDeviceCancellationBroker = new Mock <IDeviceCancellationBroker>();

            mockSubController = new Mock <IDeviceSubStateController>();
            //mockSubController.SetupGet(e => e.LoggingClient).Returns(mockLoggingClient.Object);
            mockSubController.Setup(e => e.GetDeviceCancellationBroker()).Returns(mockDeviceCancellationBroker.Object);

            subject = new DeviceSanityCheckSubStateAction(mockSubController.Object);

            asyncManager = new DeviceSubStateMachineAsyncManager(ref mockSubController, subject);

            using (kernel = new StandardKernel())
            {
                kernel.Bind <DeviceGetStatusSubStateAction>().ToSelf();
                kernel.Inject(subject);
            }
        }
Esempio n. 2
0
        public GenericSubStateManagerImplTests()
        {
            mockIDeviceSubStateController = new Mock <IDeviceSubStateController>();
            mockIDeviceStateController    = new Mock <IDeviceStateController>();

            subject = new GenericSubStateManagerImpl(mockIDeviceStateController.Object);

            stateIDeviceSubStateAction = new DeviceRequestCompleteSubStateAction(mockIDeviceSubStateController.Object);
            asyncManager = new DeviceSubStateMachineAsyncManager(ref mockIDeviceSubStateController, stateIDeviceSubStateAction);
        }
        public DeviceRequestSubCompleteStateActionTests()
        {
            linkRequest = new LinkRequest()
            {
                //LinkObjects = new LinkRequestIPA5Object
                //{
                //    LinkActionResponseList = new List<XO.Responses.LinkActionResponse>()
                //},
                //Actions = new List<LinkActionRequest>()
                //{
                //    new LinkActionRequest()
                //    {
                //        MessageID = Helpers.RandomGenerator.BuildRandomString(8),
                //        Timeout = 10000
                //    }
                //}
            };
            //linkRequest.LinkObjects = SampleBuilder.LinkObjectsForEvents();
            //linkRequest.LinkObjects.LinkActionResponseList[0].MessageID = "Authentication";
            //linkRequest.LinkObjects.LinkActionResponseList[0].DeviceResponse.Devices = new List<LinkDeviceResponse>()
            //{
            //    new LinkDeviceResponse()
            //    {
            //        Manufacturer = "NoDevice",
            //        CardWorkflowControls = new LinkCardWorkflowControls()
            //        {
            //            CardCaptureTimeout = 10,
            //            ManualCardTimeout = 5
            //        }
            //    }
            //};

            //mockLoggingClient = new Mock<ILoggingServiceClient>();

            //mockConnector = new Mock<IListenerConnector>();
            mockController = new Mock <IDeviceSubStateController>();
            //mockController.SetupGet(e => e.LoggingClient).Returns(mockLoggingClient.Object);
            //mockController.SetupGet(e => e.Connector).Returns(mockConnector.Object);

            subject = new DeviceRequestCompleteSubStateAction(mockController.Object);

            asyncManager = new DeviceSubStateMachineAsyncManager(ref mockController, subject);

            using (kernel = new StandardKernel())
            {
                kernel.Bind <DeviceGetStatusSubStateAction>().ToSelf();
                kernel.Inject(subject);
            }
        }
Esempio n. 4
0
        public DeviceResetCommandSubStateActionTests()
        {
            linkRequest = new LinkRequest()
            {
                //LinkObjects = new LinkRequestIPA5Object
                //{
                //    LinkActionResponseList = new List<XO.Responses.LinkActionResponse>()
                //},
                Actions = new List <LinkActionRequest>()
                {
                    new LinkActionRequest()
                    {
                        MessageID     = RandomGenerator.BuildRandomString(8),
                        Timeout       = 10000,
                        DeviceRequest = new LinkDeviceRequest()
                        {
                            DeviceIdentifier = new LinkDeviceIdentifier()
                            {
                                Manufacturer = "DeviceMockerInc",
                                Model        = "DeviceMokerModel",
                                SerialNumber = "CEEEDEADBEEF"
                            }
                        }
                    }
                }
            };
            //linkRequest.LinkObjects = SampleBuilder.LinkObjectsForEvents();
            //linkRequest.LinkObjects.LinkActionResponseList[0].MessageID = "Authentication";
            //linkRequest.LinkObjects.LinkActionResponseList[0].DeviceResponse.Devices = new List<LinkDeviceResponse>()
            //{
            //    new LinkDeviceResponse()
            //    {
            //        Manufacturer = DeviceType.NoDevice.ToString(),
            //        CardWorkflowControls = new LinkCardWorkflowControls()
            //        {
            //            CardCaptureTimeout = 10,
            //            ManualCardTimeout = 5
            //        }
            //    }
            //};

            deviceInformation = new DeviceInformation()
            {
                Manufacturer = linkRequest.Actions[0].DeviceRequest.DeviceIdentifier.Manufacturer,
                Model        = linkRequest.Actions[0].DeviceRequest.DeviceIdentifier.Model,
                SerialNumber = linkRequest.Actions[0].DeviceRequest.DeviceIdentifier.SerialNumber,
            };

            //mockLoggingClient = new Mock<ILoggingServiceClient>();

            mockDeviceCancellationBroker = new Mock <IDeviceCancellationBroker>();

            mockSubController = new Mock <IDeviceSubStateController>();
            //mockSubController.SetupGet(e => e.LoggingClient).Returns(mockLoggingClient.Object);
            mockSubController.Setup(e => e.GetDeviceCancellationBroker()).Returns(mockDeviceCancellationBroker.Object);

            fakeDeviceOne.Setup(e => e.DeviceInformation).Returns(deviceInformation);
            cardDevices.AddRange(new ICardDevice[] { fakeDeviceOne.Object, fakeDeviceTwo.Object });
            mockSubController.SetupGet(e => e.TargetDevices).Returns(cardDevices);

            subject = new DeviceResetCommandSubStateAction(mockSubController.Object);
            subject.SetState(linkRequest);

            asyncManager = new DeviceSubStateMachineAsyncManager(ref mockSubController, subject);

            using IKernel kernel = new StandardKernel();
            kernel.Bind <DeviceResetCommandSubStateAction>().ToSelf();
            kernel.Inject(subject);
        }