public void Dispose_Context()
        {
            TestingContext testingContext = Substitute.For <TestingContext>();

            new AuditLogger(testingContext).Dispose();

            testingContext.Received().Dispose();
        }
Beispiel #2
0
        public void Dispose_Context()
        {
            TestingContext testingContext = Substitute.For <TestingContext>();

            new UnitOfWork(testingContext).Dispose();

            testingContext.Received().Dispose();
        }
Beispiel #3
0
        public void Commit_SavesChanges()
        {
            TestingContext testingContext = Substitute.For <TestingContext>();

            new UnitOfWork(testingContext).Commit();

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

            unitOfWork.Dispose();

            context.Received().Dispose();
        }
Beispiel #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();
        }
Beispiel #8
0
        public void Dispose_Context()
        {
            TestingContext testingContext = Substitute.For <TestingContext>();

            testingContext.ChangeTracker.Returns(context.ChangeTracker);

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

            testingContext.Received().Dispose();
        }
Beispiel #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);
        }