Ejemplo n.º 1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            ArgsService = new ArgsService();
            if (!ArgsService.Parse(e.Args))
            {
                MessageBox.Show("Error while parsing app arguments!");
            }

            ShowWindow();
        }
Ejemplo n.º 2
0
        public void Constructor_CreateConfigArg_SetCreateConfigToTrue()
        {
            // Arrage

            // Act
            var argsService = new ArgsService(new[]
            {
                "--create-config",
            });

            // Assert
            Assert.That(argsService.GetArgs().CreateConfig, Is.True);
        }
Ejemplo n.º 3
0
        public void Constructor_ConfigArgWithoutPath_ThrowException()
        {
            // Arrange

            // Act
            void Code()
            {
                var argsService = new ArgsService(new[]
                {
                    "--config",
                });
            }

            // Assert
            Assert.That(Code, Throws.TypeOf <Exception>());
        }
Ejemplo n.º 4
0
        public void Constructor_ConfigArgWithPath_ExtractPath()
        {
            // Arrange
            var expectedPath = @"C:\Test\Path\config.xml";

            // Act
            var argsService = new ArgsService(new[]
            {
                "--config",
                expectedPath,
            });
            var actualPath = argsService.GetArgs().ConfigFilePath;

            // Assert
            Assert.That(actualPath, Is.EqualTo(expectedPath));
        }