Пример #1
0
        public async Task CheckIfCheckIfAddressIsValidForUserReturnsFalse()
        {
            var options = new DbContextOptionsBuilder<ApplicationDbContext>()
                .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options;
            var dbContext = new ApplicationDbContext(options);

            var repository = new EfDeletableEntityRepository<Address>(dbContext);

            var address = new Address()
            {
                Id = 1,
                UserId = Guid.NewGuid().ToString(),
            };

            dbContext.Add(address);
            await dbContext.SaveChangesAsync();
            var service = new AddressesService(repository);
            var result = service.CheckIfAddressIsValidForUser(1, Guid.NewGuid().ToString());

            Assert.False(result);
        }