public void Dispose() { // Act _textFile.Dispose(); // Verify Assert.False(_memoryStream.CanRead); Assert.False(_memoryStream.CanWrite); }
public void Dispose_ReturnNotThowException() { var file = new TextFile(); Action action = () => file.Dispose(); action.Should().NotThrow <Exception>(); }
public void CountTexts() { var textFile = new TextFile(TextFilePath); Assert.NotNull(textFile); Assert.NotEqual(0, textFile.Count); textFile.Dispose(); }
public void GetTextValueWithSpacesFromIndexer() { var textFile = new TextFile(TextFilePath); Assert.NotNull(textFile); string text = textFile[TextKeyWithSpaces]; Assert.Equal(TextValueWithSpaces, text); textFile.Dispose(); }
public void GetTextValueWithTabsFromMethod() { var textFile = new TextFile(TextFilePath); Assert.NotNull(textFile); string text = textFile.GetText(TextKeyWithTabs); Assert.Equal(TextValueWithTabs, text); textFile.Dispose(); }
public void TryGetSingleCommentedTextFromMethod() { var textFile = new TextFile(TextFilePath); Assert.NotNull(textFile); var exception = Assert.Throws <KeyNotFoundException>(() => { string value = textFile.GetText(TextSingleCommentedKey); }); Assert.NotNull(exception); Assert.Equal(typeof(KeyNotFoundException), exception.GetType()); textFile.Dispose(); }
public void TextFileContentEqualsNullAfterDisposable() { TestSetup(); TextFile file = new TextFile("./file.txt"); file.Dispose(); Assert.IsNull(file.Content); // TestTool Code UnitTest test = Factory.CreateTest(); TestVariable <TextFile> _file = test.CreateVariable <TextFile>(); test.Arrange(_file, Expr(() => new TextFile("./file.txt"))); test.Act(Expr(_file, f => f.Dispose())); test.Assert.IsNull(Expr(_file, f => f.Content)); test.Execute(); }
public void TestFileContentReadsFileContentCorrectly() { TestSetup(); TextFile file = new TextFile("./file.txt"); Assert.AreEqual("content of file", file.Content); file.Dispose(); // TestTools Code UnitTest test = Factory.CreateTest(); TestVariable <TextFile> _file = test.CreateVariable <TextFile>(); TestSetup(); test.Arrange(_file, Expr(() => new TextFile("./file.txt"))); test.Assert.AreEqual(Const("content of file"), Expr(_file, f => f.Content)); test.Act(Expr(_file, f => f.Dispose())); test.Execute(); }