public async Task CreateAsync_ShouldGenerateConfirmationCodeToNewSubscriber() { var subscriberService = new SubscriberService(this.dbContext); var newSubscriberEmail = "*****@*****.**"; var newSubscriber = await subscriberService.CreateAsync(newSubscriberEmail); var newSubscriberFromDb = await this.dbContext.Subscribers.FindAsync(newSubscriber.Id); Assert.NotNull(newSubscriberFromDb.ConfirmationCode); }
public async Task CreateAsync_ShouldAddNewSubscriber_WithNotConfirmedEmail() { var subscriberService = new SubscriberService(this.dbContext); var newSubscriberEmail = "*****@*****.**"; var newSubscriber = await subscriberService.CreateAsync(newSubscriberEmail); var newSubscriberFromDb = await this.dbContext.Subscribers.FindAsync(newSubscriber.Id); Assert.False(newSubscriberFromDb.IsConfirmed); }
public async Task CreateAsync_ShouldAddNewSubscriberToDb() { var subscriberService = new SubscriberService(this.dbContext); var newSubscriberEmail = "*****@*****.**"; await subscriberService.CreateAsync(newSubscriberEmail); const int expected = 1; var actual = this.dbContext.Subscribers.Count(); Assert.Equal(expected, actual); }