public async Task GenerateCardShouldReturnNewCard() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()).Options; var db = new ApplicationDbContext(options); var repository = new EfDeletableEntityRepository <Card>(db); var service = new CardsService(repository, this.qrcodeService.Object, this.notificationsService.Object); var result = await service.GenerateCardAsync(new ApplicationUser()); Assert.IsType <Card>(result); }
public async Task GenerateCardShouldHavePropertiesAfterCreation() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()).Options; var db = new ApplicationDbContext(options); var repository = new EfDeletableEntityRepository <Card>(db); var service = new CardsService(repository, this.qrcodeService.Object, this.notificationsService.Object); var result = await service.GenerateCardAsync(new ApplicationUser()); Assert.NotNull(result.Id); Assert.NotNull(result.UserId); Assert.Equal(0, result.Visits); }