public void Should_save_summary() { string filePath = Guid.NewGuid().ToString(); const string expectedText = "some expected text"; try { _formatter.Stub(f => f.Format(Arg <IFeatureResult[]> .Is.Anything)).Return(expectedText); _subject.SaveSummary(filePath); Assert.That(File.ReadAllText(filePath), Is.EqualTo(expectedText)); } finally { File.Delete(filePath); } }
public void Should_save_results_to_file_even_if_directory_does_not_exist() { const string expectedText = "some expected text"; var feature = new FeatureResult("name", "description", "label"); try { _formatter.Stub(f => f.Format(Arg <IFeatureResult[]> .Matches(l => l.Contains(feature)))).Return(expectedText); _subject.Save(feature); Assert.That(File.ReadAllText(_filePath), Is.EqualTo(expectedText)); } finally { File.Delete(_filePath); Directory.Delete(_dirPath); } }
public void Should_add_and_save_results() { const string expectedText = "some expected text"; var feature = new FeatureResult("name", "description", "label"); try { _formatter.Stub(f => f.Format(Arg <IFeatureResult[]> .Matches(l => l.Contains(feature)))).Return(expectedText); _subject.AddFeature(feature); _subject.Finished(); Assert.That(File.ReadAllText(_filePath), Is.EqualTo(expectedText)); } finally { File.Delete(_filePath); } }