Esempio n. 1
0
        public async Task RemovesExistingListItemsForList()
        {
            const string ID      = "id";
            const string ITEM_ID = "itemId";

            using (var context = Setup.CreateContext())
            {
                var list = new List
                {
                    Id = "id"
                };
                context.Lists.Add(list);

                context.ListItems.Add(new ListItem
                {
                    Id         = ITEM_ID,
                    ParentList = list
                });

                context.SaveChanges();

                var request = new DeleteListRequest(ID);
                var handler = new DeleteListHandler(context);
                var result  = await handler.Handle(request, CancellationToken.None);

                Assert.AreEqual(0, context.ListItems.Count());
            }
        }
Esempio n. 2
0
        public async Task RemovesExistingListContributorsForList()
        {
            const string ID   = "id";
            const string USER = "******";

            using (var context = Setup.CreateContext())
            {
                context.Lists.Add(new List
                {
                    Id = "id"
                });

                context.ListContributors.Add(new ListContributor
                {
                    ListId    = ID,
                    UserIdent = USER
                });

                context.SaveChanges();

                var request = new DeleteListRequest(ID);
                var handler = new DeleteListHandler(context);
                var result  = await handler.Handle(request, CancellationToken.None);

                Assert.AreEqual(0, context.ListContributors.Count());
            }
        }
Esempio n. 3
0
        public async Task ReturnsEmptyUnit()
        {
            using (var context = Setup.CreateContext())
            {
                var request = new DeleteListRequest("n/a");
                var handler = new DeleteListHandler(context);
                var result  = await handler.Handle(request, CancellationToken.None);

                Assert.AreEqual(Unit.Value, result);
            }
        }
Esempio n. 4
0
        public async Task DoesNothingIfNoListFoundWithId()
        {
            const string ID = "id";

            using (var context = Setup.CreateContext())
            {
                var request = new DeleteListRequest(ID);
                var handler = new DeleteListHandler(context);
                var result  = await handler.Handle(request, CancellationToken.None);

                // no assertion, as long as no exception we're fine
            }
        }
Esempio n. 5
0
        public async Task RemovesExistingListWithId()
        {
            const string ID = "id";

            using (var context = Setup.CreateContext())
            {
                // setup existing list
                context.Lists.Add(new List
                {
                    Id = "id"
                });
                context.SaveChanges();

                var request = new DeleteListRequest(ID);
                var handler = new DeleteListHandler(context);
                var result  = await handler.Handle(request, CancellationToken.None);

                Assert.AreEqual(0, context.Lists.Count());
            }
        }