public void DeleteAsync_Should_Delete_Data_And_Should_Return_Null(Mock <ISessionManager> mockSessionManager, DefaultSession session, Dummy data) { //Arrange mockSessionManager.Setup(m => m.Current) .Returns(session); var options = new DbContextOptionsBuilder <DummyContext>() .UseInMemoryDatabase("DummyDb") .Options; var context = new DummyContext(options, mockSessionManager.Object); var repository = new WriteRepository <DummyContext, Dummy>(context); repository.Add(data); //Act repository.DeleteAsync(data.Id); //Assert Dummy dummyData = repository.GetById(data.Id); dummyData.Should().BeNull(); context.Dispose(); }