public void AreEqualFailsWithStreams() { string expectedFile = "TestImage1.jpg"; string actualFile = "TestImage2.jpg"; using (TestFile tf1 = new TestFile(expectedFile, Resources.TestImage1)) { using (TestFile tf2 = new TestFile(actualFile, Resources.TestImage2)) { using (FileStream expected = File.OpenRead(expectedFile)) { using (FileStream actual = File.OpenRead(actualFile)) { expectedMessage = string.Format(" Expected Stream length {0} but was {1}." + Environment.NewLine, new FileInfo(expectedFile).Length, new FileInfo(actualFile).Length); EnsureBase <Ensure> .Files.AreEqual(expected, actual); } } } } }
public void AreNotEqualIteratesOverTheEntireFileAndFails() { using (TestFile tf1 = new TestFile( "TestText1.txt", Resources.TestText1 )) { using (TestFile tf2 = new TestFile( "TestText2.txt", Resources.TestText1 )) { expectedMessage = " Expected: not <System.IO.FileStream>" + Environment.NewLine + " But was: <System.IO.FileStream>" + Environment.NewLine; EnsureBase<Ensure>.Files.AreNotEqual( "TestText1.txt", "TestText2.txt" ); } } }
public void AreNotEqualFailsWithFiles() { using (TestFile tf1 = new TestFile( "TestImage1.jpg", Resources.TestImage1 )) { expectedMessage = " Expected: not <System.IO.FileStream>" + Environment.NewLine + " But was: <System.IO.FileStream>" + Environment.NewLine; EnsureBase<Ensure>.Files.AreNotEqual( "TestImage1.jpg", "TestImage1.jpg" ); } }
public void AreNotEqualFailsWithFileInfos() { using (TestFile tf1 = new TestFile( "TestImage1.jpg", Resources.TestImage1 )) { using (TestFile tf2 = new TestFile( "TestImage2.jpg", Resources.TestImage1 )) { FileInfo expected = new FileInfo( "TestImage1.jpg" ); FileInfo actual = new FileInfo( "TestImage2.jpg" ); expectedMessage = " Expected: not <System.IO.FileStream>" + Environment.NewLine + " But was: <System.IO.FileStream>" + Environment.NewLine; EnsureBase<Ensure>.Files.AreNotEqual( expected, actual ); } } }
public void AreNotEqualFailsWithStreams() { using (TestFile tf1 = new TestFile( "TestImage1.jpg", Resources.TestImage1 )) { using (TestFile tf2 = new TestFile( "TestImage2.jpg", Resources.TestImage1 )) { using (FileStream expected = File.OpenRead( "TestImage1.jpg" )) { using (FileStream actual = File.OpenRead( "TestImage2.jpg" )) { EnsureBase<Ensure>.Files.AreNotEqual( expected, actual ); } } } } }
public void AreNotEqualIteratesOverTheEntireFile() { using (TestFile tf1 = new TestFile( "TestText1.txt", Resources.TestText1 )) { using (TestFile tf2 = new TestFile( "TestText2.txt", Resources.TestText2 )) { EnsureBase<Ensure>.Files.AreNotEqual( "TestText1.txt", "TestText2.txt" ); } } }
public void AreNotEqualPassesWithFileInfos() { using (TestFile tf1 = new TestFile( "TestImage1.jpg", Resources.TestImage1 )) { using (TestFile tf2 = new TestFile( "TestImage2.jpg", Resources.TestImage2 )) { FileInfo expected = new FileInfo( "TestImage1.jpg" ); FileInfo actual = new FileInfo( "TestImage2.jpg" ); EnsureBase<Ensure>.Files.AreNotEqual( expected, actual ); } } }
public void AreNotEqualPassesWithFiles() { using (TestFile tf1 = new TestFile( "TestImage1.jpg", Resources.TestImage1 )) { using (TestFile tf2 = new TestFile( "TestImage2.jpg", Resources.TestImage2 )) { EnsureBase<Ensure>.Files.AreNotEqual( "TestImage1.jpg", "TestImage2.jpg" ); } } }
public void AreNotEqualPassesIfOneIsNull() { using (TestFile tf1 = new TestFile( "TestImage1.jpg", Resources.TestImage1 )) { using (FileStream expected = File.OpenRead( "TestImage1.jpg" )) { EnsureBase<Ensure>.Files.AreNotEqual( expected, null ); } } }
public void AreEqualFailsWithTextFilesAfterReadingBothFiles() { using (TestFile tf1 = new TestFile( "TestText1.txt", Resources.TestText1 )) { using (TestFile tf2 = new TestFile( "TestText2.txt", Resources.TestText2 )) { expectedMessage = " Stream lengths are both 65600. Streams differ at offset 65597." + Environment.NewLine; EnsureBase<Ensure>.Files.AreEqual( "TestText1.txt", "TestText2.txt" ); } } }
public void AreEqualFailsWithFiles() { string expected = "TestImage1.jpg"; string actual = "TestImage2.jpg"; using (TestFile tf1 = new TestFile( expected, Resources.TestImage1 )) { using (TestFile tf2 = new TestFile( actual, Resources.TestImage2 )) { expectedMessage = string.Format( " Expected Stream length {0} but was {1}." + Environment.NewLine, new FileInfo( expected ).Length, new FileInfo( actual ).Length ); EnsureBase<Ensure>.Files.AreEqual( expected, actual ); } } }
public void AreEqualFailsWithFileInfos() { using (TestFile tf1 = new TestFile( "TestImage1.jpg", Resources.TestImage1 )) { using (TestFile tf2 = new TestFile( "TestImage2.jpg", Resources.TestImage2 )) { FileInfo expected = new FileInfo( "TestImage1.jpg" ); FileInfo actual = new FileInfo( "TestImage2.jpg" ); expectedMessage = string.Format( " Expected Stream length {0} but was {1}." + Environment.NewLine, expected.Length, actual.Length ); EnsureBase<Ensure>.Files.AreEqual( expected, actual ); } } }
public void AreEqualFailsWhenOneIsNull() { using (TestFile tf1 = new TestFile( "TestImage1.jpg", Resources.TestImage1 )) { using (FileStream expected = File.OpenRead( "TestImage1.jpg" )) { expectedMessage = " Expected: <System.IO.FileStream>" + Environment.NewLine + " But was: null" + Environment.NewLine; EnsureBase<Ensure>.Files.AreEqual( expected, null ); } } }
public void AreEqualPassesWithTextFiles() { using (TestFile tf1 = new TestFile( "TestText1.txt", Resources.TestText1 )) { using (TestFile tf2 = new TestFile( "TestText2.txt", Resources.TestText1 )) { EnsureBase<Ensure>.Files.AreEqual( "TestText1.txt", "TestText2.txt" ); } } }
public void AreEqualPassesUsingSameFileTwice() { using (TestFile tf1 = new TestFile( "TestImage1.jpg", Resources.TestImage1 )) { EnsureBase<Ensure>.Files.AreEqual( "TestImage1.jpg", "TestImage1.jpg" ); } }