Exemplo n.º 1
0
        public void RemoveAsync_ReturnsFalse()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options;

            using (var dbContext = new ApplicationDbContext(options))
            {
                var phonesService = new PhonesService(dbContext);

                var result = phonesService.RemoveAsync(1);

                Assert.False(result.Result);
            }
        }
Exemplo n.º 2
0
        public void RemoveAsync_ReturnsTrue()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options;

            using (var dbContext = new ApplicationDbContext(options))
            {
                Phone phone = new Phone()
                {
                    PhoneNumber = "0897248721"
                };
                var phonesService = new PhonesService(dbContext);

                dbContext.Phones.Add(phone);
                dbContext.SaveChanges();

                var result = phonesService.RemoveAsync(1);

                Assert.True(result.Result);
            }
        }