Esempio n. 1
0
        public async Task MilestoneRepository_AddAsync_AddsValueToDatabase()
        {
            var expectedCount = MilestonesDbSet.Get().ToList().Count + 1;
            var entityToAdd   = MilestonesDbSet.MilestoneBuilder().Create();

            await using var context = new TimeTrackingDbContext(_dbOptions);
            var milestoneRepository = new MilestoneRepository(context);

            await milestoneRepository.AddAsync(entityToAdd);

            context.Milestones.Should().HaveCount(expectedCount);
            var entityFound = await context.Milestones.FindAsync(entityToAdd.Id);

            Assert.That(entityFound, Is.EqualTo(entityToAdd).Using(EqualityComparers.MilestoneComparer));
        }