Пример #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));
        }
Пример #2
0
        public void GetDocumentFormat_should_throw_exception_with_null_stream()
        {
            // arrange

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

            // assert
        }
Пример #3
0
        public void GetDocumentFormat_should_throw_exception_with_null_stream()
        {
            // arrange

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

            // assert
        }
Пример #4
0
        public void GetDocumentFormat_should_throw_exception_with_null_filename()
        {
            // arrange

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

            // assert
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #10
0
        public void GetDocumentFormat_should_throw_exception_if_file_not_found()
        {
            // arrange
            string fileName;

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

            // act
            NbtDocument.GetDocumentFormat(fileName);

            // assert
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }