public void WatchlistDeleteCommandHandler_Handle()
        {
            var watchlist = FakeObjects.TestWatchlistWithId();
            var user = FakeObjects.TestUserWithId();

            Watchlist deletedWatchlist = null;

            var command = new WatchlistDeleteCommand()
            {
                Id = watchlist.Id,
                UserId = user.Id
            };

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

                var commandHandler = new WatchlistDeleteCommandHandler(session);

                commandHandler.Handle(command);

                session.SaveChanges();

                deletedWatchlist = session.Load<Watchlist>(watchlist.Id);
            }

            Assert.IsNull(deletedWatchlist);
        }
Esempio n. 2
0
        public void WatchlistDeleteCommandHandler_Handle()
        {
            var watchlist = FakeObjects.TestWatchlistWithId();
            var user      = FakeObjects.TestUserWithId();

            Watchlist deletedWatchlist = null;

            var command = new WatchlistDeleteCommand()
            {
                Id     = watchlist.Id,
                UserId = user.Id
            };

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

                var commandHandler = new WatchlistDeleteCommandHandler(session);

                commandHandler.Handle(command);

                session.SaveChanges();

                deletedWatchlist = session.Load <Watchlist>(watchlist.Id);
            }

            Assert.IsNull(deletedWatchlist);
        }