public void WhenInputContains1Class_ReturnThatClass() { string input = @"class Test {}"; string expected = @"class Test {}"; CSharpClassExtractor ext = new CSharpClassExtractor(); string actual = ext.ExtractFromString(input)[0]; Assert.AreEqual(expected, actual, "Expected {0}.{1} But actual was {2}", expected,Environment.NewLine, actual); }
public void WhenSecondClassIsPrivate_ShouldNotIncludeInResult() { string input = @"class Test {} private class Test2 { void Test(){}; }"; int expected = 1; CSharpClassExtractor ext = new CSharpClassExtractor(); int actualLength = ext.ExtractFromString(input).Length; Assert.AreEqual(expected, actualLength, "Expected {0}.{1} But actual was {2}", expected, Environment.NewLine, actualLength); }
public void WhenInputContainsNamsepaceImportsAnd1Class_ReturnOnlyClass() { string input = @" using System; using System.Windows; class Test {}"; string expected = @"class Test {}"; CSharpClassExtractor ext = new CSharpClassExtractor(); string actual = ext.ExtractFromString(input)[0]; Assert.AreEqual(expected, actual, "Expected {0}.{1} But actual was {2}", expected, Environment.NewLine, actual); }
public void WhenCreateNewCSharpClassExtractor_ReturnNewObject() { CSharpClassExtractor ext = new CSharpClassExtractor(); Assert.IsNotNull(ext); }
public void ExtractFromString_ShouldAcceptStringAndReturnArrayOfString() { CSharpClassExtractor ext = new CSharpClassExtractor(); string[] classes = ext.ExtractFromString("dummy string"); Assert.IsNotNull(classes); }
public void WhenThereIsNoClass_ReturnEmptyArray() { CSharpClassExtractor ext = new CSharpClassExtractor(); string[] classes = ext.ExtractFromString("dummy string"); Assert.AreEqual(classes.Length,0,"The expected length is 0.But actual was {0}",classes.Length); }