public async Task GetAllIssuesAsync_Should_return_all_issues_Test()
            {
                // Arrange

                // // Create Mocked Context by Seeding Data
                await using var context = new DataContext(Options);

                await MockHelpers.CreateMockedDataContext(Options);

                RepositoryUnderTest = new IssueRepository(context);

                // Act

                var result = await RepositoryUnderTest.GetAllIssuesAsync();

                // Assert

                var enumerable = result.ToList();

                enumerable.Should().NotBeNullOrEmpty();
                var items = enumerable.ToList();

                items.Count.Should().Be(3);
                items[0].Id.Should().Be(IssueList[0].Id);
                items[1].Id.Should().Be(IssueList[1].Id);
                items[2].Id.Should().Be(IssueList[2].Id);
            }
        public async Task RepositoryWrapper_With_StateUnderTest_Should_Save_Test()
        {
            // Arrange

            await using var context = new DataContext(Options);

            await MockHelpers.CreateMockedDataContext(Options);

            UnitUnderTest = new RepositoryWrapper(context);


            // Act

            var item = await UnitUnderTest.Issue.GetIssueByIdAsync(1);

            item.DateCompleted = DateTimeOffset.Now;

            UnitUnderTest.Issue.UpdateIssue(item);

            var result = context.ChangeTracker.Entries();

            result.ToList().First().State.Should().Be(EntityState.Modified);

            await UnitUnderTest.SaveAsync();

            // Assert

            var result2 = context.ChangeTracker.Entries();

            result2.ToList().First().State.Should().Be(EntityState.Unchanged);
        }
        public async Task RepositoryWrapper_Should_Return_An_IssueRepository_With_Context_Test()
        {
            // Arrange

            await using var context = new DataContext(Options);

            await MockHelpers.CreateMockedDataContext(Options);

            UnitUnderTest = new RepositoryWrapper(context);

            // Act

            var result = UnitUnderTest.Issue;

            // Assert

            result.Should().BeOfType <IssueRepository>();
        }
            public async Task GetIssueByIdAsync_Should_return_null_if_the_issue_does_not_exist_Test()
            {
                // Arrange
                const int invalidId = 5;

                // // Create Mocked Context by Seeding Data
                await using var context = new DataContext(Options);

                await MockHelpers.CreateMockedDataContext(Options);

                RepositoryUnderTest = new IssueRepository(context);


                // Act
                var result = await RepositoryUnderTest.GetIssueByIdAsync(invalidId);

                // Assert
                Assert.Null(result);
            }
        protected IssueRepositoryUnitTests()
        {
            IssueList = new List <Issue>
            {
                new Issue {
                    Id = 1, IssueDescription = "Test 1", DateAdded = DateTimeOffset.Now
                },
                new Issue {
                    Id = 2, IssueDescription = "Test 2", DateAdded = DateTimeOffset.Now
                },
                new Issue {
                    Id = 3, IssueDescription = "Test 3", DateAdded = DateTimeOffset.Now
                }
            };
            Options = MockHelpers.SetDbContextOptions();

            var context = MockHelpers.CreateMockedDataContext(Options).Result;

            RepositoryUnderTest = new IssueRepository(context);
        }
            public async Task GetIssueByIdAsync_Should_return_the_expected_Issue_Test()
            {
                // Arrange

                // // Create Mocked Context by Seeding Data
                await using var context = new DataContext(Options);

                await MockHelpers.CreateMockedDataContext(Options);

                RepositoryUnderTest = new IssueRepository(context);


                // Act

                var result = await RepositoryUnderTest.GetIssueByIdAsync(IssueList[1].Id);

                // Assert

                result.Should().NotBeNull();
                result.Id.Should().Be(IssueList[1].Id);
            }
            public async Task DeleteAsync_Should_Set_the_Entity_State_as_Deleted_Test()
            {
                // Arrange

                // // Create Mocked Context by Seeding Data
                await using var context = new DataContext(Options);

                await MockHelpers.CreateMockedDataContext(Options);

                RepositoryUnderTest = new IssueRepository(context);

                // Act

                RepositoryUnderTest.DeleteIssue(IssueList[0]);

                // Assert

                var result = context.ChangeTracker.Entries();

                result.First().State.Should().Be(EntityState.Deleted);
            }