Example #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));
        }
Example #2
0
        public void GetDocumentFormat_should_throw_exception_with_null_stream()
        {
            // arrange

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

            // assert
        }
        public void GetDocumentFormat_should_throw_exception_with_null_stream()
        {
            // arrange

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

            // assert
        }
        public void GetDocumentFormat_should_throw_exception_with_null_filename()
        {
            // arrange

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

            // assert
        }
Example #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);
        }
        public void GetDocumentFormat_throws_exception_for_non_seekable_streams()
        {
            // arrange
            Stream stream;

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

            // act
            NbtDocument.GetDocumentFormat(stream);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
        public void GetDocumentFormat_should_throw_exception_if_file_not_found()
        {
            // arrange
            string fileName;

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

            // act
            NbtDocument.GetDocumentFormat(fileName);

            // assert
        }
        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);
        }
        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);
        }
        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);
        }