public void TestShouldCreateEventStoreAndThrowPayloadNullException() { // Arrange var sut = new CreateStoreObject<BookModel>(); // Act & Assert MyAssert.Throws<PayloadNullException>(() => sut.CreateWriteEvent(null, CommandType.Insert)); }
public void TestShouldCreateEventStoreFromBook() { // Arrange var sut = new CreateStoreObject<BookModel>(); // Act var result = sut.CreateWriteEvent(SampleBooks.CreateBook(), CommandType.Insert); // Assert var payload = JsonConvert.DeserializeObject<BookModel>(result.Payload); Assert.AreEqual("Yuval Noah Harari", payload.Author); Assert.AreEqual(CommandType.Insert, result.CommandType); }
public void TestShouldCreateEventStoreFromGdto() { // Arrange var sut = new CreateStoreObject<Gdto>(); // Act var result = sut.CreateWriteEvent(SampleGdto.CreateGdto(), CommandType.Insert); // Assert var payload = JsonConvert.DeserializeObject<Gdto>(result.Payload); Assert.AreEqual("Yuval Noah Harari", payload.Properties.Single(p => p.Key == "Author").Value); Assert.AreEqual(CommandType.Insert, result.CommandType); Assert.AreEqual(TimeStamp, result.Timestamp); }