Exemplo n.º 1
0
        public void GetDocumentFormat_should_throw_exception_if_file_not_found()
        {
            // arrange
            var fileName = Guid.NewGuid().ToString();

            // act
            Assert.Throws <FileNotFoundException>(() => NbtDocument.GetDocumentFormat(fileName));
        }
Exemplo n.º 2
0
        public void GetDocumentFormat_should_throw_exception_with_null_stream()
        {
            // arrange

            // act
            Assert.Throws <ArgumentNullException>(() => NbtDocument.GetDocumentFormat((Stream)null));

            // assert
        }
Exemplo n.º 3
0
        public void GetDocumentFormat_should_throw_exception_with_null_stream()
        {
            // arrange

            // act
            NbtDocument.GetDocumentFormat((Stream)null);

            // assert
        }
Exemplo n.º 4
0
        public void GetDocumentFormat_should_throw_exception_with_null_filename()
        {
            // arrange

            // act
            NbtDocument.GetDocumentFormat((string)null);

            // assert
        }
Exemplo n.º 5
0
        public void GetDocumentFormat_throws_exception_for_non_seekable_streams()
        {
            // arrange
            Stream stream = new DeflateStream(Stream.Null, CompressionMode.Decompress);

            // act
            var e = Assert.Throws <ArgumentException>(() => NbtDocument.GetDocumentFormat(stream));

            Assert.Equal($"Stream is not seekable.{Environment.NewLine}Parameter name: stream", e.Message);
        }
Exemplo n.º 6
0
        public void GetDocumentFormat_throws_exception_for_non_seekable_streams()
        {
            // arrange
            Stream stream;

            stream = new DeflateStream(Stream.Null, CompressionMode.Decompress);

            // act
            NbtDocument.GetDocumentFormat(stream);
        }
Exemplo n.º 7
0
        public void GetFormatXmlTest()
        {
            // arrange
            var             fileName = ComplexXmlDataFileName;
            const NbtFormat expected = NbtFormat.Xml;

            // act
            var actual = NbtDocument.GetDocumentFormat(fileName);

            // assert
            Assert.Equal(expected, actual);
        }
Exemplo n.º 8
0
        public void GetFormatInvalidTest()
        {
            // arrange
            var             fileName = BadFileName;
            const NbtFormat expected = NbtFormat.Unknown;

            // act
            var actual = NbtDocument.GetDocumentFormat(fileName);

            // assert
            Assert.Equal(expected, actual);
        }
Exemplo n.º 9
0
        public void GetFormatDeflateBinaryTest()
        {
            // arrange
            var             fileName = DeflateComplexDataFileName;
            const NbtFormat expected = NbtFormat.Binary;

            // act
            var actual = NbtDocument.GetDocumentFormat(fileName);

            // assert
            Assert.Equal(expected, actual);
        }
Exemplo n.º 10
0
        public void GetDocumentFormat_should_throw_exception_if_file_not_found()
        {
            // arrange
            string fileName;

            fileName = Guid.NewGuid().ToString();

            // act
            NbtDocument.GetDocumentFormat(fileName);

            // assert
        }
Exemplo n.º 11
0
        public void GetFormatXmlTest()
        {
            // arrange
            NbtFormat expected;
            NbtFormat actual;
            string    fileName;

            fileName = this.ComplexXmlDataFileName;
            expected = NbtFormat.Xml;

            // act
            actual = NbtDocument.GetDocumentFormat(fileName);

            // assert
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 12
0
        public void GetFormatInvalidTest()
        {
            // arrange
            NbtFormat expected;
            NbtFormat actual;
            string    fileName;

            fileName = this.BadFileName;
            expected = NbtFormat.Unknown;

            // act
            actual = NbtDocument.GetDocumentFormat(fileName);

            // assert
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 13
0
        public void GetFormatDeflateBinaryTest()
        {
            // arrange
            NbtFormat expected;
            NbtFormat actual;
            string    fileName;

            fileName = this.DeflateComplexDataFileName;
            expected = NbtFormat.Binary;

            // act
            actual = NbtDocument.GetDocumentFormat(fileName);

            // assert
            Assert.AreEqual(expected, actual);
        }