Exemple #1
0
        public async Task CanGetNewUser()
        {
            DbContextOptions <CardDbContext> options = new DbContextOptionsBuilder <CardDbContext>().UseInMemoryDatabase("GetNewUser").Options;

            using (CardDbContext context = new CardDbContext(options))
            {
                UserMgmtSvc svc = new UserMgmtSvc(context);

                Assert.Equal("test", (await svc.GetUserAsync("test")).Name);
            }
        }
Exemple #2
0
        public async Task CanCreateCollectDeck()
        {
            DbContextOptions <CardDbContext> options = new DbContextOptionsBuilder <CardDbContext>().UseInMemoryDatabase("GetNewUser").Options;

            using (CardDbContext context = new CardDbContext(options))
            {
                UserMgmtSvc svc = new UserMgmtSvc(context);

                User user = await svc.GetUserAsync("test");

                var query = await context.Decks.FirstOrDefaultAsync(d => d.UserID == user.ID && d.DeckType == DeckType.Collect);

                Assert.NotNull(query);
            }
        }
Exemple #3
0
        public async Task CanUpdateSecondCard()
        {
            DbContextOptions <CardDbContext> options = new DbContextOptionsBuilder <CardDbContext>().UseInMemoryDatabase("TestUserCards").Options;

            using (CardDbContext context = new CardDbContext(options))
            {
                UserMgmtSvc svc = new UserMgmtSvc(context);

                User user = await svc.GetUserAsync("test");

                user.SecondCard = 1;
                await svc.UpdateFirstCard("test", 1);

                Assert.Equal(1, user.SecondCard);
            }
        }