public void PartialReadTest()
 {
     // read the whole thing as one tag
     TestFiles.AssertValueTest(PartialReadTestInternal(new NbtFile(TestFiles.MakeValueTest())));
     TestFiles.AssertNbtSmallFile(PartialReadTestInternal(TestFiles.MakeSmallFile()));
     TestFiles.AssertNbtBigFile(PartialReadTestInternal(new NbtFile(TestFiles.Big)));
 }
Esempio n. 2
0
 public void PartialBatchReadTest()
 {
     // read the whole thing as one tag, in batches of 4 bytes
     // Verifies fix for https://github.com/fragmer/fNbt/issues/26
     TestFiles.AssertValueTest(PartialReadTestInternal(new NbtFile(TestFiles.MakeValueTest()), 4));
     TestFiles.AssertNbtSmallFile(PartialReadTestInternal(TestFiles.MakeSmallFile(), 4));
     TestFiles.AssertNbtBigFile(PartialReadTestInternal(new NbtFile(TestFiles.Big), 4));
 }
Esempio n. 3
0
    public void TestNbtSmallFileSavingUncompressed()
    {
        NbtFile file         = TestFiles.MakeSmallFile();
        string  testFileName = Path.Combine(TestDirName, "test.nbt");

        file.SaveToFile(testFileName, NbtCompression.None);
        FileAssert.Equal(TestFiles.Small, testFileName);
    }
Esempio n. 4
0
    public void TestNbtSmallFileSavingUncompressedStream()
    {
        NbtFile file      = TestFiles.MakeSmallFile();
        var     nbtStream = new MemoryStream();

        Assert.Throws <ArgumentNullException>(() => file.SaveToStream(null, NbtCompression.None));
        Assert.Throws <ArgumentException>(() => file.SaveToStream(nbtStream, NbtCompression.AutoDetect));
        Assert.Throws <ArgumentOutOfRangeException>(() => file.SaveToStream(nbtStream, (NbtCompression)255));
        file.SaveToStream(nbtStream, NbtCompression.None);
        FileStream testFileStream = File.OpenRead(TestFiles.Small);
        //FileAssert.Equal(testFileStream, nbtStream);
    }