Example #1
0
        public async void TestCreateRecipientList()
        {
            var options = new DbContextOptionsBuilder <MessageContext>()
                          .UseInMemoryDatabase(databaseName: "p3MessageService")
                          .Options;

            using (var context = new MessageContext(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                Repo              r                 = new Repo(context, new NullLogger <Repo>());
                Mapper            map               = new Mapper();
                Logic             logic             = new Logic(r, map, new NullLogger <Repo>());
                MessageController messageController = new MessageController(logic, null);

                var createCarpoolDto = new CreateCarpoolDto
                {
                    CarpoolID = Guid.NewGuid(),
                    UserID    = "34543235"
                };

                var recipientList = new RecipientList
                {
                    RecipientListID = Guid.NewGuid(),
                    RecipientID     = "342134"
                };


                r.RecipientLists.Add(recipientList);
                await r.CommitSave();

                var createRecipientList = await messageController.CreateRecipientList(createCarpoolDto);

                Assert.NotNull(createRecipientList);
            }
        }