public void EFRepository_AddStatsRecord_ValidCall() { List <Stats> statsList = CreateTestData.GetListOfStats(); var mockSet = new Mock <DbSet <Stats> >() .SetupData(statsList, o => { return(statsList.Single(x => x.Character_id.CompareTo(o.First()) == 0)); }); using (var mockContext = AutoMock.GetLoose()) { var expected = CreateTestData.GetSampleStats(); var id = Guid.Parse("b346eee6-eba7-4ea7-be2e-911bb9034233"); expected.Character_id = id; mockContext.Mock <CharacterContext>() .Setup(x => x.Set <Stats>()).Returns(mockSet.Object); //Act IStatsRepository toTest = mockContext.Create <StatsRepository>(); toTest.Add(expected); var actual = toTest.Get(id); actual.Should().NotBeNull(); expected.Should().NotBeNull(); actual.Should().BeOfType <Stats>(); expected.Should().BeOfType <Stats>(); actual.Should().BeEquivalentTo(expected); } }