public static void CallDbContextSaveChangesMethod() { //Arrange var mockedDbContext = new Mock <IShishaTimeDbContext>(); mockedDbContext.Setup(x => x.SaveChanges()).Verifiable(); var mockedBarsRepo = new Mock <IEntityFrameworkRepository <ShishaBar> >(); var mockedUsersRepo = new Mock <IEntityFrameworkRepository <User> >(); var mockedRegionsRepo = new Mock <IEntityFrameworkRepository <Region> >(); var mockedReviewsRepo = new Mock <IEntityFrameworkRepository <Review> >(); var mockedRatingsRepo = new Mock <IEntityFrameworkRepository <Rating> >(); var data = new ShishaTimeData(mockedDbContext.Object, mockedBarsRepo.Object, mockedUsersRepo.Object, mockedRegionsRepo.Object, mockedReviewsRepo.Object, mockedRatingsRepo.Object); //Act data.SaveChanges(); //Assert mockedDbContext.Verify(x => x.SaveChanges(), Times.Once); }
public void ReturnAnInstance_ParametersAreNotNull() { //Arrange var mockedContext = new Mock <IShishaTimeDbContext>(); var mockedBarsRepo = new Mock <IEntityFrameworkRepository <ShishaBar> >(); var mockedUsersRepo = new Mock <IEntityFrameworkRepository <User> >(); var mockedRegionsRepo = new Mock <IEntityFrameworkRepository <Region> >(); var mockedReviewsRepo = new Mock <IEntityFrameworkRepository <Review> >(); var mockedRatingsRepo = new Mock <IEntityFrameworkRepository <Rating> >(); //Act var data = new ShishaTimeData(mockedContext.Object, mockedBarsRepo.Object, mockedUsersRepo.Object, mockedRegionsRepo.Object, mockedReviewsRepo.Object, mockedRatingsRepo.Object); //Assert Assert.IsInstanceOf <ShishaTimeData>(data); }