Esempio n. 1
0
        public void GetDeviceApplication_ShouldReturnValidDALApplication_When_Called()
        {
            Type expectedType = typeof(DeviceApplication);

            IDeviceApplication application = subject.GetDeviceApplication();

            Assert.IsAssignableFrom(expectedType, application);
        }
Esempio n. 2
0
        static async Task Main(string[] args)
        {
            Console.WriteLine($"\r\n==========================================================================================");
            Console.WriteLine($"{Assembly.GetEntryAssembly().GetName().Name} - Version {Assembly.GetEntryAssembly().GetName().Version}");
            Console.WriteLine($"==========================================================================================\r\n");

            string pluginPath = Path.Combine(Environment.CurrentDirectory, "DevicePlugins");

            IDeviceApplication application = activator.Start(pluginPath);
            await application.Run().ConfigureAwait(false);

            await Task.Delay(5120);

            // GET STATUS
            await application.Command(LinkDeviceActionType.GetStatus).ConfigureAwait(false);

            await Task.Delay(5120);

            Console.WriteLine("\nCOMMANDS: [l=LOAD, t=TEST, s=STATUS, q=QUIT]\r\n");

            ConsoleKey keypressed = Console.ReadKey(true).Key;

            while (keypressed != ConsoleKey.Q)
            {
                switch (keypressed)
                {
                case ConsoleKey.L:
                {
                    Console.WriteLine("\r\nCOMMAND: [LOAD]");
                    break;
                }

                case ConsoleKey.T:
                {
                    Console.WriteLine("\r\nCOMMAND: [TEST]");
                    break;
                }

                case ConsoleKey.S:
                {
                    Console.WriteLine("\r\nCOMMAND: [STATUS]");
                    await application.Command(LinkDeviceActionType.GetSecurityConfiguration).ConfigureAwait(false);

                    break;
                }
                }

                await Task.Delay(50).ConfigureAwait(false);

                keypressed = Console.ReadKey(true).Key;
            }

            Console.WriteLine("\r\nCOMMAND: [QUIT]\r\n");

            application.Shutdown();
        }
Esempio n. 3
0
        public IDeviceApplication Start(string pluginPath)
        {
            if (string.IsNullOrWhiteSpace(pluginPath))
            {
                throw new ArgumentNullException(nameof(pluginPath));
            }

            IDeviceApplication application = DeviceApplicationProvider.GetDeviceApplication();

            application.Initialize(pluginPath);
            return(application);
        }
        public void Start_ShouldInitializeAndLaunchDALApplication_When_Called()
        {
            const string fakePluginPath = @"C:\somepath";

            IDeviceApplication application = subject.Start(fakePluginPath);

            mockApplicationProvider.Verify(e => e.GetDeviceApplication(), Times.Once());

            mockApplication.Verify(e => e.Initialize(fakePluginPath), Times.Once());
            //mockApplication.Verify(e => e.LaunchApplication(), Times.Once());

            Assert.Same(mockApplication.Object, application);
        }