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

            var moqSe = new Mock <ISettingsService>();

            var repository = new EfRepository <Address>(new ApplicationDbContext(options));

            var service = new AddressesService(repository);

            var addres = new Address()
            {
                Id = 1,
            };
            await repository.AddAsync(addres);

            await repository.SaveChangesAsync();

            var res = service.GetAddresById(1);

            Assert.Equal(addres, res);
        }