Пример #1
0
        public void Return_UsersRepository()
        {
            // Arrange
            var dbContext      = new Mock <IBrandviserDbContext>();
            var brandviserData = new BrandviserData(dbContext.Object);

            // Act & Assert
            Assert.IsInstanceOf <IEfRepository <User> >(brandviserData.Users);
        }
Пример #2
0
        public void ConstructorShouldCreateBrandviserData_WithValidParams()
        {
            // Arrange
            var dbContext = new Mock <IBrandviserDbContext>();

            // Act & Assert
            var brandviserData = new BrandviserData(dbContext.Object);

            Assert.IsInstanceOf <IBrandviserData>(brandviserData);
        }
Пример #3
0
        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());
        }
Пример #4
0
        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);
        }