Example #1
0
        public void DoPostUpdateActions_CalledSecondTimeAfterUpdateAndUpdateCycle_DoNothing()
        {
            // Setup
            var mocks        = new MockRepository();
            var viewCommands = mocks.StrictMock <IViewCommands>();

            viewCommands.Expect(vc => vc.RemoveAllViewsForItem(Arg <object> .Is.NotNull))
            .Repeat.Times(expectedNumberOfRemovedInstances);
            mocks.ReplayAll();

            AssessmentSection assessmentSection = TestDataGenerator.GetAssessmentSectionWithAllCalculationConfigurations();

            var handler = new ReferenceLineUpdateHandler(assessmentSection, viewCommands);

            handler.Update(assessmentSection.ReferenceLine, new ReferenceLine());
            handler.DoPostUpdateActions();

            // Call
            handler.DoPostUpdateActions(); // Expected number should be identical to that of DoPostUpdateActions_AfterUpdatingReferenceLine_CloseViewsForRemovedData

            // Assert
            mocks.VerifyAll();
        }
Example #2
0
        public void DoPostUpdateActions_NoUpdateCalled_DoNothing()
        {
            // Setup
            var mocks             = new MockRepository();
            var assessmentSection = mocks.Stub <IAssessmentSection>();
            var viewCommands      = mocks.StrictMock <IViewCommands>();

            mocks.ReplayAll();

            var handler = new ReferenceLineUpdateHandler(assessmentSection, viewCommands);

            // Call
            handler.DoPostUpdateActions();

            // Assert
            mocks.VerifyAll(); // Expect not calls in 'viewCommands'
        }