public void OrganisationCreateCommandHandler_Handle() { var user = FakeObjects.TestUserWithId(); Organisation newValue = null; var command = new OrganisationCreateCommand() { Description = FakeValues.Description, Name = FakeValues.Name, UserId = user.Id, Website = FakeValues.Website }; using (var session = _store.OpenSession()) { session.Store(user); session.SaveChanges(); var commandHandler = new OrganisationCreateCommandHandler(session); commandHandler.Handle(command); session.SaveChanges(); newValue = session.Query<Organisation>().FirstOrDefault(); } Assert.IsNotNull(newValue); Assert.AreEqual(command.Website, newValue.Website); Assert.AreEqual(command.Description, newValue.Description); Assert.AreEqual(command.Name, newValue.Name); }
public void OrganisationCreateCommandHandler_Handle() { var user = FakeObjects.TestUserWithId(); Organisation newValue = null; var command = new OrganisationCreateCommand() { Description = FakeValues.Description, Name = FakeValues.Name, UserId = user.Id, Website = FakeValues.Website }; using (var session = _store.OpenSession()) { session.Store(user); session.SaveChanges(); var commandHandler = new OrganisationCreateCommandHandler(session); commandHandler.Handle(command); session.SaveChanges(); newValue = session.Query <Organisation>().FirstOrDefault(); } Assert.IsNotNull(newValue); Assert.AreEqual(command.Website, newValue.Website); Assert.AreEqual(command.Description, newValue.Description); Assert.AreEqual(command.Name, newValue.Name); }