本文整理汇总了C#中NUnit.Framework.Tests.TestFile类的典型用法代码示例。如果您正苦于以下问题:C# TestFile类的具体用法?C# TestFile怎么用?C# TestFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestFile类属于NUnit.Framework.Tests命名空间,在下文中一共展示了TestFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AreEqualFailsWithFiles
public void AreEqualFailsWithFiles()
{
string expected = "Test1.jpg";
string actual = "Test2.jpg";
using (TestFile tf1 = new TestFile(expected, "TestImage1.jpg"))
{
using (TestFile tf2 = new TestFile(actual, "TestImage2.jpg"))
{
expectedMessage =
string.Format(" Expected Stream length {0} but was {1}." + Environment.NewLine,
new FileInfo(tf1.FileName).Length, new FileInfo(tf2.FileName).Length);
FileAssert.AreEqual( tf1.FileName, tf2.FileName );
}
}
}
示例2: AreEqualPassesWithTextFiles
public void AreEqualPassesWithTextFiles()
{
using(TestFile tf1 = new TestFile("Test1.txt","NUnit.Framework.Tests.TestText1.txt"))
{
using(TestFile tf2 = new TestFile("Test2.txt","NUnit.Framework.Tests.TestText1.txt"))
{
FileAssert.AreEqual( "Test1.txt", "Test2.txt" );
}
}
}
示例3: AreEqualFailsWithFileInfos
public void AreEqualFailsWithFileInfos()
{
using (TestFile tf1 = new TestFile("Test1.jpg", "TestImage1.jpg"))
{
using (TestFile tf2 = new TestFile("Test2.jpg", "TestImage2.jpg"))
{
FileInfo expected = new FileInfo( tf1.FileName );
FileInfo actual = new FileInfo( tf2.FileName );
expectedMessage =
string.Format(" Expected Stream length {0} but was {1}." + Environment.NewLine,
expected.Length, actual.Length);
FileAssert.AreEqual( expected, actual );
}
}
}
示例4: AreNotEqualFailsWithStreams
public void AreNotEqualFailsWithStreams()
{
using(TestFile tf1 = new TestFile("Test1.jpg","TestImage1.jpg"))
using(TestFile tf2 = new TestFile("Test2.jpg","TestImage1.jpg"))
using(FileStream expected = File.OpenRead(tf1.FileName))
using(FileStream actual = File.OpenRead(tf2.FileName))
{
expectedMessage =
" Expected: not <System.IO.FileStream>" + Environment.NewLine +
" But was: <System.IO.FileStream>" + Environment.NewLine;
FileAssert.AreNotEqual( expected, actual );
}
}
示例5: AreNotEqualFailsWithFiles
public void AreNotEqualFailsWithFiles()
{
using(TestFile tf1 = new TestFile("Test1.jpg","TestImage1.jpg"))
{
expectedMessage =
" Expected: not <System.IO.FileStream>" + Environment.NewLine +
" But was: <System.IO.FileStream>" + Environment.NewLine;
FileAssert.AreNotEqual( tf1.FileName, tf1.FileName );
}
}
示例6: AreNotEqualPassesWithStreams
public void AreNotEqualPassesWithStreams()
{
using (TestFile tf1 = new TestFile("Test1.jpg", "TestImage1.jpg"))
{
using (TestFile tf2 = new TestFile("Test2.jpg", "TestImage2.jpg"))
{
using(FileStream expected = File.OpenRead(tf1.FileName))
{
using(FileStream actual = File.OpenRead(tf2.FileName))
{
FileAssert.AreNotEqual( expected, actual);
}
}
}
}
}
示例7: AreNotEqualPassesWithFileInfos
public void AreNotEqualPassesWithFileInfos()
{
using (TestFile tf1 = new TestFile("Test1.jpg", "TestImage1.jpg"))
{
using (TestFile tf2 = new TestFile("Test2.jpg", "TestImage2.jpg"))
{
FileInfo expected = new FileInfo( tf1.FileName );
FileInfo actual = new FileInfo( tf2.FileName );
FileAssert.AreNotEqual( expected, actual );
}
}
}
示例8: NonReadableStreamGivesException
public void NonReadableStreamGivesException()
{
using (TestFile tf1 = new TestFile("Test1.jpg", "TestImage1.jpg"))
using (TestFile tf2 = new TestFile("Test2.jpg", "TestImage1.jpg"))
{
using (FileStream expected = File.OpenRead("Test1.jpg"))
{
using (FileStream actual = File.OpenWrite("Test2.jpg"))
{
FileAssert.AreEqual(expected, actual);
}
}
}
}
示例9: AreEqualFailsWithStreams
public void AreEqualFailsWithStreams()
{
string expectedFile = "Test1.jpg";
string actualFile = "Test2.jpg";
using (TestFile tf1 = new TestFile(expectedFile, "TestImage1.jpg"))
{
using (TestFile tf2 = new TestFile(actualFile, "TestImage2.jpg"))
{
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);
FileAssert.AreEqual( expected, actual);
}
}
}
}
}
示例10: AreEqualPassesWithStreams
public void AreEqualPassesWithStreams()
{
using(TestFile tf1 = new TestFile("Test1.jpg","NUnit.Framework.Tests.TestImage1.jpg"))
using(TestFile tf2 = new TestFile("Test2.jpg","NUnit.Framework.Tests.TestImage1.jpg"))
{
using(FileStream expected = File.OpenRead("Test1.jpg"))
{
using(FileStream actual = File.OpenRead("Test2.jpg"))
{
FileAssert.AreEqual( expected, actual );
}
}
}
}
示例11: AreEqualFailsWithTextFilesAfterReadingBothFiles
public void AreEqualFailsWithTextFilesAfterReadingBothFiles()
{
using(TestFile tf1 = new TestFile("Test1.txt","TestText1.txt"))
{
using(TestFile tf2 = new TestFile("Test2.txt","TestText2.txt"))
{
expectedMessage =
" Stream lengths are both 65600. Streams differ at offset 65597." + Environment.NewLine;
FileAssert.AreEqual( "Test1.txt", "Test2.txt" );
}
}
}
示例12: AreNotEqualIteratesOverTheEntireFile
public void AreNotEqualIteratesOverTheEntireFile()
{
using(TestFile tf1 = new TestFile("Test1.txt","NUnit.Framework.Tests.TestText1.txt"))
{
using(TestFile tf2 = new TestFile("Test2.txt","NUnit.Framework.Tests.TestText2.txt"))
{
FileAssert.AreNotEqual( "Test1.txt", "Test2.txt" );
}
}
}
示例13: AreNotEqualPassesWithFileInfos
public void AreNotEqualPassesWithFileInfos()
{
using(TestFile tf1 = new TestFile("Test1.jpg","NUnit.Framework.Tests.TestImage1.jpg"))
{
using(TestFile tf2 = new TestFile("Test2.jpg","NUnit.Framework.Tests.TestImage2.jpg"))
{
FileInfo expected = new FileInfo( "Test1.jpg" );
FileInfo actual = new FileInfo( "Test2.jpg" );
FileAssert.AreNotEqual( expected, actual );
}
}
}
示例14: AreNotEqualPassesWithFiles
public void AreNotEqualPassesWithFiles()
{
using(TestFile tf1 = new TestFile("Test1.jpg","NUnit.Framework.Tests.TestImage1.jpg"))
{
using(TestFile tf2 = new TestFile("Test2.jpg","NUnit.Framework.Tests.TestImage2.jpg"))
{
FileAssert.AreNotEqual( "Test1.jpg", "Test2.jpg" );
}
}
}
示例15: AreEqualFailsWithTextFilesAfterReadingBothFiles
public void AreEqualFailsWithTextFilesAfterReadingBothFiles()
{
using (TestFile tf1 = new TestFile("Test1.txt", "TestText1.txt"))
{
using (TestFile tf2 = new TestFile("Test2.txt", "TestText2.txt"))
{
FileAssert.AreEqual( tf1.FileName, tf2.FileName );
}
}
}