public void CallDataSaveChangesMethod() { //Arrange var barsRepoMock = new Mock <IEntityFrameworkRepository <ShishaBar> >(); barsRepoMock.Setup(x => x.Add(It.IsAny <ShishaBar>())).Verifiable(); var dataMock = new Mock <IShishaTimeData>(); dataMock.Setup(x => x.Bars).Verifiable(); dataMock.Setup(x => x.Bars).Returns(barsRepoMock.Object); dataMock.Setup(x => x.SaveChanges()).Verifiable(); var barsService = new BarsService(dataMock.Object); var mockedBar = new Mock <ShishaBar>(); //Act barsService.AddBar(mockedBar.Object); //Assert dataMock.Verify(x => x.SaveChanges(), Times.Once()); }