public void ShouldRebirthModel() { // Arrange var ticket = CreateFullTicket(); // Act var ticketState = serializer.SerializeObject(ticket); var newTicket = serializer.DeserializeObject(ticketState); // Assert Assert.Equal(ticket, newTicket); }
public void ShouldReadDateTimeFromUtc() { // Arrange var expectedTime = new DateTime(2015, 08, 25, 17, 30, 0, DateTimeKind.Utc); const string ticketState = "<Ticket><ShowTime>2015-08-25T17:30:00Z</ShowTime></Ticket>"; var serializer = new XmlCuteSerializer(typeof(Ticket)); // Act var ticket = serializer.DeserializeObject(ticketState) as Ticket; // Assert Assert.Equal(expectedTime, ticket?.ShowTime); Assert.Equal(DateTimeKind.Utc, ticket?.ShowTime?.Kind); }