public DeviceActivator()
 {
     using (IKernel kernel = new DeviceKernelResolver().ResolveKernel())
     {
         kernel.Inject(this);
     }
 }
        public IDeviceApplication GetDeviceApplication()
        {
            DeviceApplication application = new DeviceApplication();

            using (IKernel kernel = new DeviceKernelResolver().ResolveKernel())
            {
                kernel.Inject(application);
            }

            return(application);
        }
        public DeviceStateManagerImplTest()
        {
            subject = new DeviceStateManagerImpl();

            DeviceAppSection          = new DeviceSection();
            mockConfigurationProvider = new Mock <IDeviceConfigurationProvider>();
            mockConfigurationProvider.Setup(e => e.GetAppConfig()).Returns(DeviceAppSection);

            //mockChannelClient = new Mock<IChannelClient>();

            //mockListenerConnector = new Mock<IListenerConnector>();
            //mockListenerConnector.SetupAllProperties();
            //mockListenerConnector.Setup(e => e.ChannelClient).Returns(mockChannelClient.Object);

            //mockListenerConnectorProvider = new Mock<IListenerConnectorProvider>();
            //mockListenerConnectorProvider.Setup(e => e.GetConnector(It.IsAny<IConfiguration>())).Returns(mockListenerConnector.Object);

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

            //mockLoggingServiceClientProvider = new Mock<ILoggingServiceClientProvider>();
            //mockLoggingServiceClientProvider.Setup(e => e.GetLoggingServiceClient()).Returns(mockLoggingServiceClient.Object);

            mockDeviceStateAction = new Mock <IDeviceStateAction>();
            mockDeviceStateAction.Setup(e => e.DoWork()).Returns(Task.CompletedTask);

            mockDeviceStateActionController = new Mock <IDeviceStateActionController>();
            mockDeviceStateActionController.Setup(e => e.GetNextAction(It.IsAny <DeviceWorkflowState>())).Returns(mockDeviceStateAction.Object);
            mockDeviceStateActionController.Setup(e => e.GetFinalState()).Returns(mockDeviceStateAction.Object);

            mockDeviceStateActionControllerProvider = new Mock <IDeviceStateActionControllerProvider>();
            mockDeviceStateActionControllerProvider.Setup(e => e.GetStateActionController(subject)).Returns(mockDeviceStateActionController.Object);

            // Setup fake card devices list and also 2 fake devices for testing purposes.
            cardDevices = new List <ICardDevice>();

            fakeDeviceOne = new Mock <ICardDevice>();
            fakeDeviceTwo = new Mock <ICardDevice>();

            cardDevices.AddRange(new ICardDevice[] { fakeDeviceOne.Object, fakeDeviceTwo.Object });

            mockDevicePluginLoader = new Mock <IDevicePluginLoader>();
            mockDevicePluginLoader.Setup(e => e.FindAvailableDevices(someFakePath)).Returns(cardDevices);

            using IKernel kernel = new DeviceKernelResolver().ResolveKernel();
            //kernel.Rebind<IListenerConnectorProvider>().ToConstant(mockListenerConnectorProvider.Object);
            kernel.Rebind <IDevicePluginLoader>().ToConstant(mockDevicePluginLoader.Object);
            kernel.Rebind <IDeviceConfigurationProvider>().ToConstant(mockConfigurationProvider.Object);
            //kernel.Rebind<ILoggingServiceClientProvider>().ToConstant(mockLoggingServiceClientProvider.Object);
            kernel.Rebind <IDeviceStateActionControllerProvider>().ToConstant(mockDeviceStateActionControllerProvider.Object);
            kernel.Bind <DeviceStateManagerImpl>().ToSelf();
            kernel.Inject(subject);
        }
        public DeviceApplicationTest()
        {
            subject = new DeviceApplication();

            mockStateManager = new Mock <IDeviceStateManager>();

            using (IKernel kernel = new DeviceKernelResolver().ResolveKernel())
            {
                kernel.Rebind <IDeviceStateManager>().ToConstant(mockStateManager.Object);
                kernel.Inject(subject);
            }

            asyncManager = new DeviceStateMachineAsyncManager();
        }
        public DeviceActivatorTest()
        {
            subject = new DeviceActivator();

            mockApplication = new Mock <IDeviceApplication>();

            mockApplicationProvider = new Mock <IDeviceApplicationProvider>();
            mockApplicationProvider.Setup(e => e.GetDeviceApplication()).Returns(mockApplication.Object);

            using (IKernel kernel = new DeviceKernelResolver().ResolveKernel())
            {
                kernel.Rebind <IDeviceApplicationProvider>().ToConstant(mockApplicationProvider.Object);
                kernel.Inject(subject);
            }
        }