コード例 #1
0
        public async Task IssueRepository_AddAsync_AddsValueToDatabase()
        {
            var expectedCount = IssuesDbSet.Get().ToList().Count + 1;
            var entityToAdd   = IssuesDbSet.IssueBuilder().Create();

            await using var context = new TimeTrackingDbContext(_dbOptions);
            var issueRepository = new IssueRepository(context);

            await issueRepository.AddAsync(entityToAdd);

            context.Issues.Should().HaveCount(expectedCount);
            var entityFound = context.Issues.Find(entityToAdd.Id);

            entityFound.Should().BeEquivalentTo(entityFound);
        }