public void OrganisationUpdateCommandHandler_Handle() { var user = FakeObjects.TestUserWithId(); var organisation = FakeObjects.TestOrganisationWithId(); Organisation newValue = null; var command = new OrganisationUpdateCommand() { Description = FakeValues.Description.PrependWith("new"), Id = organisation.Id, Name = FakeValues.Name.PrependWith("new"), UserId = user.Id, Website = FakeValues.Website.PrependWith("new") }; using (var session = _store.OpenSession()) { session.Store(user); session.Store(organisation); session.SaveChanges(); var commandHandler = new OrganisationUpdateCommandHandler(session); commandHandler.Handle(command); session.SaveChanges(); newValue = session.Load<Organisation>(organisation.Id); } Assert.IsNotNull(newValue); Assert.AreEqual(command.Description, newValue.Description); Assert.AreEqual(command.Name, newValue.Name); Assert.AreEqual(command.Website, newValue.Website); }
public void OrganisationUpdateCommandHandler_Handle() { var user = FakeObjects.TestUserWithId(); var organisation = FakeObjects.TestOrganisationWithId(); Organisation newValue = null; var command = new OrganisationUpdateCommand() { Description = FakeValues.Description.PrependWith("new"), Id = organisation.Id, Name = FakeValues.Name.PrependWith("new"), UserId = user.Id, Website = FakeValues.Website.PrependWith("new") }; using (var session = _store.OpenSession()) { session.Store(user); session.Store(organisation); session.SaveChanges(); var commandHandler = new OrganisationUpdateCommandHandler(session); commandHandler.Handle(command); session.SaveChanges(); newValue = session.Load <Organisation>(organisation.Id); } Assert.IsNotNull(newValue); Assert.AreEqual(command.Description, newValue.Description); Assert.AreEqual(command.Name, newValue.Name); Assert.AreEqual(command.Website, newValue.Website); }