public async void GetPaymentMethodByName_ShouldThrowArgumentNullExceptionIfMethodIsNull() { var options = new DbContextOptionsBuilder <TechAndToolsDbContext>() .UseInMemoryDatabase(databaseName: "GetPaymentMethodByName_ShouldThrowArgumentNullExceptionIfMethodIsNull") .Options; var context = new TechAndToolsDbContext(options); await SeedData(context); IPaymentMethodService paymentMethodService = new PaymentMethodService(context); await Assert.ThrowsAsync <ArgumentNullException>(() => paymentMethodService.GetPaymentMethodByName("blabla")); }
public async void GetPaymentMethodByName_ShouldReturnPaymentMethodFromDatabase() { var options = new DbContextOptionsBuilder <TechAndToolsDbContext>() .UseInMemoryDatabase(databaseName: "GetPaymentMethodByName_ShouldReturnPaymentMethodFromDatabase") .Options; var context = new TechAndToolsDbContext(options); await SeedData(context); IPaymentMethodService paymentMethodService = new PaymentMethodService(context); var actualResult = await paymentMethodService.GetPaymentMethodByName("payment1"); Assert.NotNull(actualResult); Assert.Equal("payment1", actualResult.Name); }