Пример #1
0
        public void Dispose_Context()
        {
            TestingContext testingContext = Substitute.For <TestingContext>();

            new AuditLogger(testingContext).Dispose();

            testingContext.Received().Dispose();
        }
Пример #2
0
        public void Dispose_Context()
        {
            TestingContext testingContext = Substitute.For <TestingContext>();

            new UnitOfWork(testingContext).Dispose();

            testingContext.Received().Dispose();
        }
Пример #3
0
        public void Commit_SavesChanges()
        {
            TestingContext testingContext = Substitute.For <TestingContext>();

            new UnitOfWork(testingContext).Commit();

            testingContext.Received().SaveChanges();
        }
Пример #4
0
        public void Dispose_Context()
        {
            TestingContext context    = Substitute.For <TestingContext>();
            UnitOfWork     unitOfWork = new UnitOfWork(context);

            unitOfWork.Dispose();

            context.Received().Dispose();
        }
Пример #5
0
        public void Commit_SavesChanges()
        {
            TestingContext context    = Substitute.For <TestingContext>();
            UnitOfWork     unitOfWork = new UnitOfWork(context);

            unitOfWork.Commit();

            context.Received().SaveChanges();
        }
        public void Dispose_Context()
        {
            TestingContext context = Substitute.For <TestingContext>();
            AuditLogger    logger  = new AuditLogger(context);

            logger.Dispose();

            context.Received().Dispose();
        }
        public void Save_Logs()
        {
            TestingContext context = Substitute.For <TestingContext>();

            logger = Substitute.ForPartsOf <AuditLogger>(context);

            logger.Save();

            context.Received().SaveChanges();
        }
Пример #8
0
        public void Dispose_Context()
        {
            TestingContext testingContext = Substitute.For <TestingContext>();

            testingContext.ChangeTracker.Returns(context.ChangeTracker);

            new AuditLogger(testingContext, 0).Dispose();

            testingContext.Received().Dispose();
        }
Пример #9
0
        public void InsertRange_AddsModelsToDbSet()
        {
            IEnumerable <TestModel> models         = new[] { ObjectsFactory.CreateTestModel(1), ObjectsFactory.CreateTestModel(2) };
            TestingContext          testingContext = Substitute.For <TestingContext>();

            testingContext.When(sub => sub.AddRange(models)).DoNotCallBase();

            unitOfWork.Dispose();

            unitOfWork = new UnitOfWork(testingContext);
            unitOfWork.InsertRange(models);

            testingContext.Received().AddRange(models);
        }