public void TestShouldCreateTimestamp_Validate_Invalid() { // Given var now = new DateTime(1850, 12, 21, 7, 7, 7); var origin = Origin.Create(Guids.Two(), nameof(TimestampTests), nameof(TestShouldCreateTimestamp_Validate_Invalid)); // When var result = Timestamp.Create(now, origin); // Then Assert.IsTrue(result.IsInvalid()); }
public void TestShouldCreateRequest_None() { // Given var message = (Message.Create(Guids.Two(), "{\"name\": \"Jane Doe\"}", new DateTime(2021, 1, 1), MessageTypes.Unknown)); // When var result = message.CreateRequest(); // Then Assert.IsTrue(result.IsNone); }
public void TestShouldCreateRequest_Remove() { // Given var message = (Message.Create(Guids.Two(), "{\"id\": \"5998b4d5-ff78-415f-9ffa-62df1e27dfe8\",\"name\": \"Jane Doe\"}", new DateTime(2021, 1, 1), MessageTypes.ThingRemoved)); // When var result = message.CreateRequest(); // Then Assert.IsTrue(result.IsSome); var remove = (Remove)result.GetOrException(); Assert.AreEqual("5998b4d5-ff78-415f-9ffa-62df1e27dfe8", remove.Id.ToString()); Assert.AreEqual(Guids.Two(), remove.MessageId); }
public void TestShouldCreateRequest_Add() { // Given var message = (Message.Create(Guids.Two(), "{\"name\": \"Jane Doe\"}", new DateTime(2021, 1, 1), MessageTypes.NewThing)); // When var result = message.CreateRequest(); // Then Assert.IsTrue(result.IsSome); var add = (Add)result.GetOrException(); Assert.AreEqual("Jane Doe", add.Name); Assert.AreEqual(Guids.Two(), add.MessageId); }