Esempio n. 1
0
        public void ExecutorExecuteReturnArgumentProcessorResultSuccess()
        {
            var options  = CommandLineOptions.Instance;
            var executor = new TestSourceArgumentExecutor(options);
            var result   = executor.Execute();

            Assert.AreEqual(ArgumentProcessorResult.Success, result);
        }
Esempio n. 2
0
        public void ExecuterInitializeWithValidSourceShouldAddItToTestSources()
        {
            var testFilePath   = "DummyTestFile.txt";
            var mockFileHelper = new Mock <IFileHelper>();

            mockFileHelper.Setup(fh => fh.Exists(testFilePath)).Returns(true);
            var options = CommandLineOptions.Instance;

            options.Reset();
            options.FileHelper = mockFileHelper.Object;
            var executor = new TestSourceArgumentExecutor(options);

            executor.Initialize(testFilePath);

            // Check if the testsource is present in the TestSources
            Assert.IsTrue(options.Sources.Contains(testFilePath));
        }
Esempio n. 3
0
        public void ExecuterInitializeWithInvalidSourceShouldThrowCommandLineException()
        {
            var options = CommandLineOptions.Instance;
            TestSourceArgumentExecutor executor = new TestSourceArgumentExecutor(options);

            // This path is invalid
            string testFilePath = "TestFile.txt";

            try
            {
                executor.Initialize(testFilePath);
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex is CommandLineException);
                Assert.AreEqual("The test source file \"" + testFilePath + "\" provided was not found.", ex.Message);
            }
        }
Esempio n. 4
0
        public void ExecuterInitializeWithInvalidSourceShouldThrowCommandLineException()
        {
            var options        = CommandLineOptions.Instance;
            var mockFileHelper = new Mock <IFileHelper>();

            mockFileHelper.Setup(x => x.GetCurrentDirectory()).Returns("");
            options.FileHelper = mockFileHelper.Object;
            TestSourceArgumentExecutor executor = new TestSourceArgumentExecutor(options);

            // This path is invalid
            string testFilePath = "TestFile.txt";

            try
            {
                executor.Initialize(testFilePath);
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex is TestSourceException);
                Assert.AreEqual("The test source file \"" + testFilePath + "\" provided was not found.", ex.Message);
            }
        }