コード例 #1
0
        public void EfDataProvider_Constructor_Should_Return_Object()
        {
            //Arrange & Act
            var mockedDbContext           = new Mock <IEfSociumDbContext>();
            EfSociumDataProvider provider = new EfSociumDataProvider(mockedDbContext.Object);

            //Assert
            Assert.IsInstanceOf <EfSociumDataProvider>(provider);
        }
コード例 #2
0
        public void EfDataProvider_Get_Votes()
        {
            //Arrange
            var mockedDbContext           = new Mock <IEfSociumDbContext>();
            EfSociumDataProvider provider = new EfSociumDataProvider(mockedDbContext.Object);

            //Act
            var res = provider.Votes;

            //Assert
            Assert.IsInstanceOf <IEfRepository <Vote> >(res);
        }
コード例 #3
0
        public void EfDataProvider_Should_Call_DbContext_SaveChanges_When_Call_Commit()
        {
            //Arrange
            var mockedDbContext = new Mock <IEfSociumDbContext>();

            mockedDbContext.Setup(c => c.SaveChanges());
            EfSociumDataProvider provider = new EfSociumDataProvider(mockedDbContext.Object);

            //Act
            provider.Commit();

            //Assert
            mockedDbContext.Verify(c => c.SaveChanges(), Times.Once);
        }