public void MinusHelpDisplaysUsage() { int result = CsUnitApp.Main(new string[] { "-help" }); Assert.Equals(0, result); Assert.Contains("Starts a new instance of csUnitCmd. Usage:", Output); }
public void ReturnsTwoWhenTestsAbort() { var app = new CsUnitApp(); var result = app.ExecuteValidCommandLine(new CmdLineHandler(), new AbortingRecipe()); Assert.Equals(2, result); }
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); }
public void NoRecipeNameSpecified() { int result = CsUnitApp.Main(new[] { "/recipe" }); Assert.Equals(1, result); Assert.Contains("Error: Option 'recipe' requires value.", Output); }
public void NoRecipeNameSpecifiedIncludingColon() { var result = CsUnitApp.Main(new[] { "/recipe:" }); Assert.Equals(1, result); Assert.Contains("Error: Option 'recipe' requires value.", Output); }
public void AddsSelectorForFixtureCategory() { int result = CsUnitApp.Main(new string[] { "/fixtureCategory:blue", _recipeOption }); Assert.Equals(0, result); Assert.ContainsType(typeof(CategorySelector), RecipeMock._selectors); }
public void TestCategoryOptionWithoutValueFails() { int result = CsUnitApp.Main(new string[] { "/testCategory", _recipeOption }); Assert.Equals(1, result); Assert.Contains("Error: Option 'testCategory' requires value.", Output); }
public void SlashQuestionMarkDisplaysUsage() { int result = CsUnitApp.Main(new string[] { "/?" }); Assert.Equals(0, result); Assert.Contains("Starts a new instance of csUnitCmd. Usage:", Output); }
public void SuccessfulRecipeRead() { RecipeFactory.Type = typeof(RecipeMock); int result = CsUnitApp.Main(new[] { @"/recipe:..\..\coreassemblies.recipe" }); Assert.Equals(0, result); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); } } }
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()); }