public void ProcessClass() { tg.ProcessClass(); string path = @"C:\TestFiles\FileUtilityTest.cs"; FileUtility fu = new FileUtility(path); fu.WriteString(tg.TestText); }
public void GenerateMethodTest() { tg.GetMethods(); MethodInfo mi = tg.TypeToTest.GetMethod("GetIndexOfStringInFile"); string actual = tg.GenerateMethodTest(mi); string path = @"C:\TestFiles\testmethodgen.txt"; FileUtility fu = new FileUtility(path); fu.WriteString(actual); //Expect(actual, Is.EqualTo("public void GetIndexOfStringInFile()")); Expect(actual.IndexOf("[Test]"), Is.Not.EqualTo(-1)); Expect(actual.IndexOf("public void GetIndexOfStringInFile()"), Is.Not.EqualTo(-1)); Expect(actual.IndexOf("{"), Is.Not.EqualTo(-1)); Expect(actual.IndexOf("string strToAppend = expected;"), Is.Not.EqualTo(-1)); Expect(actual.IndexOf("fu.AppendStringToSpaceDelimitedFile(strToAppend);"), Is.Not.EqualTo(-1)); Expect(actual.IndexOf("string strToFind = \"delimited\";"), Is.Not.EqualTo(-1)); Expect(actual.IndexOf("Int32 actual = fu.GetIndexOfStringInFile(strToFind);"), Is.Not.EqualTo(-1)); Expect(actual.IndexOf("Expect(actual, Is.EqualTo(2));"), Is.Not.EqualTo(-1)); Expect(actual.IndexOf("}"), Is.Not.EqualTo(-1)); }