public void TeamCreateCommandHandler_Handle()
        {
            var user = FakeObjects.TestUserWithId();
            var organisation = FakeObjects.TestOrganisationWithId();

            Team newValue = null;

            var command = new TeamCreateCommand()
            {
                UserId = user.Id,
                Description = FakeValues.Description,
                Name = FakeValues.Name,
                Website = FakeValues.Website
            };

            using (var session = _store.OpenSession())
            {
                session.Store(user);
                session.Store(organisation);
                session.SaveChanges();

                var commandHandler = new TeamCreateCommandHandler(session);
                commandHandler.Handle(command);
                session.SaveChanges();

                newValue = session.Query<Team>().FirstOrDefault();
            }

            Assert.IsNotNull(newValue);
            Assert.AreEqual(command.Description , newValue.Description);
            Assert.AreEqual(command.Name, newValue.Name);
            Assert.AreEqual(command.Website, newValue.Website);
        }
Пример #2
0
        public void TeamCreateCommandHandler_Handle()
        {
            var user         = FakeObjects.TestUserWithId();
            var organisation = FakeObjects.TestOrganisationWithId();

            Team newValue = null;

            var command = new TeamCreateCommand()
            {
                UserId      = user.Id,
                Description = FakeValues.Description,
                Name        = FakeValues.Name,
                Website     = FakeValues.Website
            };

            using (var session = _store.OpenSession())
            {
                session.Store(user);
                session.Store(organisation);
                session.SaveChanges();

                var commandHandler = new TeamCreateCommandHandler(session);
                commandHandler.Handle(command);
                session.SaveChanges();

                newValue = session.Query <Team>().FirstOrDefault();
            }

            Assert.IsNotNull(newValue);
            Assert.AreEqual(command.Description, newValue.Description);
            Assert.AreEqual(command.Name, newValue.Name);
            Assert.AreEqual(command.Website, newValue.Website);
        }