Beispiel #1
0
        public async void TestForCreateTeamArticle()
        {
            var options = new DbContextOptionsBuilder <NewsContext>()
                          .UseInMemoryDatabase(databaseName: "p3NewsService")
                          .Options;

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

                Repo           r              = new Repo(context, new NullLogger <Repo>());
                Logic          logic          = new Logic(r, new NullLogger <Repo>());
                NewsController newsController = new NewsController(logic);
                var            teamArticleDto = new TeamArticleDto()
                {
                    ArticleID = Guid.NewGuid(),
                    Title     = "free hotdogs",
                    Content   = "come today to get your hotdogs!",
                    Date      = DateTime.Now,
                    IsPinned  = true,
                    IsVisible = true,
                    TeamID    = Guid.NewGuid()
                };

                await newsController.CreateTeamArticle(teamArticleDto);

                Assert.NotNull(context.LeagueArticles);
            }
        }