public XContainer Serialize(NonceDataRecord nonce)
        {
            if (nonce == null)
            {
                throw new ArgumentNullException(nameof(nonce));
            }

            return(nonce.ToXml());
        }
        public NonceDataRecord Deserialize(XContainer data)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }

            return(NonceDataRecord.FromXml(data));
        }
Пример #3
0
        public void CanRoundTrip()
        {
            var dataRecord = new NonceDataRecord {
                ClientId   = "client001",
                Value      = "abc",
                Expiration = new DateTime(2021, 1, 26, 15, 39, 22, DateTimeKind.Utc)
            };

            var xml = _sut.Serialize(dataRecord).ToString();

            var xContainer   = XElement.Parse(xml);
            var deserialized = _sut.Deserialize(xContainer);

            deserialized.Should().BeEquivalentTo(dataRecord);
        }