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