Пример #1
0
        public void MinusHelpDisplaysUsage()
        {
            int result = CsUnitApp.Main(new string[] { "-help" });

            Assert.Equals(0, result);
            Assert.Contains("Starts a new instance of csUnitCmd. Usage:", Output);
        }
Пример #2
0
        public void ReturnsTwoWhenTestsAbort()
        {
            var app    = new CsUnitApp();
            var result = app.ExecuteValidCommandLine(new CmdLineHandler(), new AbortingRecipe());

            Assert.Equals(2, result);
        }
Пример #3
0
        public void NonExistentRecipe()
        {
            int result = CsUnitApp.Main(new[] { "/recipe:deleteMe.recipe" });

            Assert.Equals(1, result);
            Assert.Contains("Couldn't read recipe at location 'deleteMe.recipe'.", Output);
        }
Пример #4
0
        public void NoRecipeNameSpecified()
        {
            int result = CsUnitApp.Main(new[] { "/recipe" });

            Assert.Equals(1, result);
            Assert.Contains("Error: Option 'recipe' requires value.", Output);
        }
Пример #5
0
        public void NoRecipeNameSpecifiedIncludingColon()
        {
            var result = CsUnitApp.Main(new[] { "/recipe:" });

            Assert.Equals(1, result);
            Assert.Contains("Error: Option 'recipe' requires value.", Output);
        }
Пример #6
0
        public void AddsSelectorForFixtureCategory()
        {
            int result = CsUnitApp.Main(new string[] { "/fixtureCategory:blue", _recipeOption });

            Assert.Equals(0, result);
            Assert.ContainsType(typeof(CategorySelector), RecipeMock._selectors);
        }
Пример #7
0
        public void TestCategoryOptionWithoutValueFails()
        {
            int result = CsUnitApp.Main(new string[] { "/testCategory", _recipeOption });

            Assert.Equals(1, result);
            Assert.Contains("Error: Option 'testCategory' requires value.", Output);
        }
Пример #8
0
        public void SlashQuestionMarkDisplaysUsage()
        {
            int result = CsUnitApp.Main(new string[] { "/?" });

            Assert.Equals(0, result);
            Assert.Contains("Starts a new instance of csUnitCmd. Usage:", Output);
        }
Пример #9
0
        public void SuccessfulRecipeRead()
        {
            RecipeFactory.Type = typeof(RecipeMock);
            int result = CsUnitApp.Main(new[] { @"/recipe:..\..\coreassemblies.recipe" });

            Assert.Equals(0, result);
        }
Пример #10
0
        public void WithColonOnly()
        {
            var result = CsUnitApp.Main(new[] { "/assembly:" });

            Assert.Equals(1, result);
            Assert.Contains("Error: Option 'assembly' requires value.", Output);
            Assert.Contains("Starts a new instance of csUnitCmd. Usage:", Output);
        }
Пример #11
0
        public void CustomXmlFile()
        {
            XmlDocumentMock.PathName = _recipePathName;
            int result = CsUnitApp.Main(new string[] { "/xml:testres.xml", _recipeOption });

            Assert.Equals(0, result);
            Assert.Equals("testres.xml", XmlDocumentMock.PathName);
        }
Пример #12
0
        public void XmlOptionWithOutFileName()
        {
            XmlDocumentMock.PathName = _recipePathName;
            int result = CsUnitApp.Main(new string[] { "/xml", _recipeOption });

            Assert.Equals(0, result);
            Assert.Equals("csUnit.results.xml", XmlDocumentMock.PathName);
        }
Пример #13
0
        public void WithNonExistingFile()
        {
            var result = CsUnitApp.Main(new[] { "/assembly:nirwana.dll" });

            Assert.Equals(1, result);
            Assert.Contains("Error: Couldn't read assembly at location 'nirwana.dll'.", Output);
            Assert.Contains("Starts a new instance of csUnitCmd. Usage:", Output);
        }
Пример #14
0
        public void UnknownOptionDisplaysUsage()
        {
            int result = CsUnitApp.Main(new string[] { "/foo" });

            Assert.Equals(1, result);
            Assert.Contains("Error: Invalid option 'foo'.", Output);
            Assert.Contains("Starts a new instance of csUnitCmd. Usage:", Output);
        }
Пример #15
0
        public void AddsSelectorForTestCategoryOption()
        {
            XmlDocumentFactory.Type  = typeof(XmlDocumentMock);
            XmlDocumentMock.PathName = _recipePathName;
            int result = CsUnitApp.Main(new string[] { "/testCategory:green", _recipeOption });

            Assert.Equals(0, result);
            Assert.ContainsType(typeof(CategorySelector), RecipeMock._selectors);
        }
Пример #16
0
        public void ExceptionThrownDoesntReturnSuccess()
        {
            RecipeFactory.Type = typeof(RecipeMockThrowingException);
            var result = CsUnitApp.Main(new[] { @"/recipe:..\..\coreassemblies.recipe" });

            Assert.Equals(1, result);
            Assert.Contains("Internal error: ", Output);
            Assert.Contains("Thrown from within RecipeMockThrowingException.", Output);
        }
Пример #17
0
        public void TryRecipeAsAssembly()
        {
            RecipeFactory.Type = RecipeFactory.Default;
            const string recipePathName = @"..\..\coreassemblies.recipe";
            var          result         = CsUnitApp.Main(new[] { "/assembly:" + recipePathName });

            Assert.Equals(1, result);
            Assert.Contains("File for option /assembly does not refer to an assembly. Must be DLL or EXE.", Output);
        }
Пример #18
0
        public void IgnoredIfRecipeOptionPresent()
        {
            RecipeFactory.Type        = typeof(RecipeMock);
            RecipeMock.RecipePathName = string.Empty;
            const string recipePathName = @"..\..\coreassemblies.recipe";
            var          result         = CsUnitApp.Main(new[] { "/assembly:nirwana.dll",
                                                                 "/recipe:" + recipePathName });

            Assert.Equals(0, result);
            Assert.Contains("Option 'recipe' present, ignoring option 'assembly'.", Output);
            Assert.Equals(recipePathName, RecipeMock.RecipePathName);
        }
Пример #19
0
        public void SimplePattern()
        {
            int result = CsUnitApp.Main(new[] { "/pattern:.*Foo.*", RecipeOption });

            Assert.Equals(0, result);
            Assert.ContainsType(typeof(RegexSelector), RecipeMock._selectors);
            foreach (ISelector selector in RecipeMock._selectors)
            {
                RegexSelector regexSelector = selector as RegexSelector;
                if (regexSelector != null)
                {
                    Assert.Equals(@".*Foo.*", regexSelector.Pattern);
                }
            }
        }
Пример #20
0
        public void SelectorContainsTestCategory()
        {
            int result = CsUnitApp.Main(new string[] { "/testCategory:green", _recipeOption });

            Assert.Equals(0, result);
            CategorySelector categorySelector = null;

            foreach (ISelector selector in RecipeMock._selectors)
            {
                categorySelector = selector as CategorySelector;
                if (null != categorySelector)
                {
                    break;
                }
            }
            Assert.Contains("green", categorySelector.IncludedCategories.ToArray());
        }
Пример #21
0
 public void ReturnsTwoWhenTestsAbort() {
    var app = new CsUnitApp();
    var result = app.ExecuteValidCommandLine(new CmdLineHandler(), new AbortingRecipe());
    Assert.Equals(2, result);
 }