Ejemplo n.º 1
0
        public async Task GetCustomersCountShouldBeCorrect()
        {
            var options = new DbContextOptionsBuilder <WHMSDbContext>().UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options;

            using var context = new WHMSDbContext(options);
            context.Customers.Add(new Customer {
                Email = "*****@*****.**", FirstName = "Pesho", LastName = "Peshov", PhoneNumber = "000000", Address = new Address {
                }
            });
            await context.SaveChangesAsync();

            var service = new CustomersService(context);

            var count = service.CustomersCount();

            Assert.Equal(1, count);
        }