public void CallDbContext_SaveMethod() { // Arrange var mockedDbContext = new Mock <IDatabaseContext>(); mockedDbContext.Setup(c => c.Save()).Returns(1).Verifiable(); var studentClassService = new StudentClassService(mockedDbContext.Object); // Act var result = studentClassService.Save(); // Assert Assert.IsTrue(result == 1); mockedDbContext.Verify(c => c.Save(), Times.Once); }