public void ObservationNoteUpdateCommandHandler_Handle() { var originalValue = FakeObjects.TestObservationNoteWithId(); var observation = FakeObjects.TestObservationWithId(); var user = FakeObjects.TestUserWithId(); ObservationNote newValue; var command = new ObservationNoteUpdateCommand() { Id = originalValue.Id, UserId = user.Id, CommonName = FakeValues.CommonName.PrependWith("new"), ScientificName = FakeValues.ScientificName.PrependWith("new"), Notes = FakeValues.Notes.PrependWith("new"), Tags = FakeValues.Tags, Taxonomy = FakeValues.Taxonomy.PrependWith("new"), NotedOn = FakeValues.ModifiedDateTime, References = new Dictionary <string, string>() { { FakeValues.Description.PrependWith("new"), FakeValues.Description.PrependWith("new") } }, Descriptions = new Dictionary <string, string>() { { FakeValues.Description.PrependWith("new"), FakeValues.Description.PrependWith("new") } }, }; using (var session = _store.OpenSession()) { session.Store(originalValue); session.Store(observation); session.Store(user); var commandHandler = new ObservationNoteUpdateCommandHandler(session); commandHandler.Handle(command); session.SaveChanges(); newValue = session.Load <ObservationNote>(originalValue.Id); } Assert.IsNotNull(newValue); Assert.AreEqual(command.CommonName, newValue.CommonName); Assert.AreEqual(command.ScientificName, newValue.ScientificName); Assert.AreEqual(command.Tags, newValue.Tags); Assert.AreEqual(command.Taxonomy, newValue.Taxonomy); Assert.AreEqual(command.References, newValue.References); Assert.AreEqual(command.Descriptions, newValue.Descriptions); }
public void ObservationNoteUpdateCommandHandler_Handle() { var originalValue = FakeObjects.TestObservationNoteWithId(); var observation = FakeObjects.TestObservationWithId(); var user = FakeObjects.TestUserWithId(); ObservationNote newValue; var command = new ObservationNoteUpdateCommand() { Id = originalValue.Id, UserId = user.Id, CommonName = FakeValues.CommonName.PrependWith("new"), ScientificName = FakeValues.ScientificName.PrependWith("new"), Notes = FakeValues.Notes.PrependWith("new"), Tags = FakeValues.Tags, Taxonomy = FakeValues.Taxonomy.PrependWith("new"), NotedOn = FakeValues.ModifiedDateTime, References = new Dictionary<string, string>() { { FakeValues.Description.PrependWith("new"), FakeValues.Description.PrependWith("new") } }, Descriptions = new Dictionary<string, string>() { { FakeValues.Description.PrependWith("new"), FakeValues.Description.PrependWith("new") } }, }; using (var session = _store.OpenSession()) { session.Store(originalValue); session.Store(observation); session.Store(user); var commandHandler = new ObservationNoteUpdateCommandHandler(session); commandHandler.Handle(command); session.SaveChanges(); newValue = session.Load<ObservationNote>(originalValue.Id); } Assert.IsNotNull(newValue); Assert.AreEqual(command.CommonName, newValue.CommonName); Assert.AreEqual(command.ScientificName, newValue.ScientificName); Assert.AreEqual(command.Tags, newValue.Tags); Assert.AreEqual(command.Taxonomy, newValue.Taxonomy); Assert.AreEqual(command.References, newValue.References); Assert.AreEqual(command.Descriptions, newValue.Descriptions); }