public void WriteObjectEnd_WhenDisposed_Throws()
        {
            _writer.WriteObjectStart();
            _writer.Dispose();

            Assert.Throws <ObjectDisposedException>(() => _writer.WriteObjectEnd());
        }
Example #2
0
        public void GetHash_ComputesOverEntireObject()
        {
            _writer.WriteObjectStart("a");
            _writer.WriteNameValue("b", 0);
            _writer.WriteNameValue("c", "d");
            _writer.WriteNameArray("e", new[] { "f", "g" });
            _writer.WriteObjectEnd();

            const string expectedHash = "TGP0LarTsGYQ2bqAC8lWyRQR+JsKzsO0Y+h6w7mtTj6mBOLTy8Dr0ZypSgzwzD9xuddh2ceDT7fEXve5ohuNeQ==";
            var          actualHash   = _writer.GetHash();

            Assert.Equal(expectedHash, actualHash);
        }