public void Return_UsersRepository() { // Arrange var dbContext = new Mock <IBrandviserDbContext>(); var brandviserData = new BrandviserData(dbContext.Object); // Act & Assert Assert.IsInstanceOf <IEfRepository <User> >(brandviserData.Users); }
public void ConstructorShouldCreateBrandviserData_WithValidParams() { // Arrange var dbContext = new Mock <IBrandviserDbContext>(); // Act & Assert var brandviserData = new BrandviserData(dbContext.Object); Assert.IsInstanceOf <IBrandviserData>(brandviserData); }
public void Call_dbContext_SaveChanges_Once() { // Arrange var dbContext = new Mock <IBrandviserDbContext>(); var brandviserData = new BrandviserData(dbContext.Object); // Act brandviserData.SaveChanges(); // Assert dbContext.Verify(d => d.SaveChanges(), Times.Once()); }
public void Return_Same_Instance_When_Called_MoreThanOnce() { // Arrange var dbContext = new Mock <IBrandviserDbContext>(); var brandviserData = new BrandviserData(dbContext.Object); // Act var expected = brandviserData.Users; var actual = brandviserData.Users; // Assert Assert.AreSame(expected, actual); }