public void Blows_IfResourceName_Invalid() { b.Info.Flow(); var sut = new UnitTestHelper(); try { Assert.Throws <InvalidOperationException>(() => { _ = sut.GetTestDataFile("monkey-butt"); }); } finally { sut.ClearUpTestFiles(); } }
public void GetTestDatFile_BlowsOnNull() { b.Info.Flow(); Assert.Throws <ArgumentOutOfRangeException>(() => { var sut = new UnitTestHelper(); sut.GetTestDataFile(null); }); Assert.Throws <ArgumentOutOfRangeException>(() => { var sut = new UnitTestHelper(); sut.GetTestDataFile(""); }); }
public void TestDataFile_CleanUpWorks() { b.Info.Flow(); var sut = new UnitTestHelper(); var ident = TestResources.GetIdentifiers(TestResourcesReferences.SingleTextFile); string fname = sut.GetTestDataFile(ident); bool fileExistsBeforeCleanup = File.Exists(fname); sut.ClearUpTestFiles(); Assert.True(fileExistsBeforeCleanup); Assert.False(File.Exists(fname)); }
public void File_GetTestData_Works() { b.Info.Flow(); var sut = new UnitTestHelper(); try { var ident = TestResources.GetIdentifiers(TestResourcesReferences.SingleTextFile); string fname = sut.GetTestDataFile(ident); Assert.NotNull(fname); Assert.True(File.Exists(fname)); } finally { sut.ClearUpTestFiles(); } }
public void File_GetTestData_HasRightContent() { const string TEXT_FROM_FILE = "arfle barfle gloop"; b.Info.Flow(); var sut = new UnitTestHelper(); try { var ident = TestResources.GetIdentifiers(TestResourcesReferences.SingleTextFile); string fname = sut.GetTestDataFile(ident); string str = File.ReadAllText(fname); Assert.Equal(TEXT_FROM_FILE, str); } finally { sut.ClearUpTestFiles(); } }