Exemplo n.º 1
0
        public async void CreateAsync_ChangesQtyAndSavesModelRight()
        {
            //Arrange
            var options       = InMemoryUtils.ProduceFreshDbContextOptions();
            var expectedCount = 1;
            var addedModel    = ResourceUtils.TestSet.First();

            //Act
            using (var context = new ApplicationDbContext(options))
            {
                IBasicRepositoryAsync <Resource, int> repo = new ResourcesRepository(context);
                await repo.CreateAsync(addedModel);
            }

            //Assert
            using (var context = new ApplicationDbContext(options))
            {
                Assert.Equal(addedModel.Title, context.Resources.First().Title);
                Assert.Equal(expectedCount, context.Resources.Count());
            }
        }