Example #1
0
        private static void Property_SetNewValue_NotifyObserversAndPropertyChanged <T>(
            Action <NonAdoptableWithProfileProbabilityFailureMechanismSectionResultRow> setPropertyAction,
            Func <NonAdoptableWithProfileProbabilityFailureMechanismSectionResult, T> assertPropertyFunc,
            T newValue)
        {
            // Setup
            var mocks         = new MockRepository();
            var errorProvider = mocks.Stub <IFailureMechanismSectionResultRowErrorProvider>();
            var observer      = mocks.StrictMock <IObserver>();

            observer.Expect(o => o.UpdateObserver());
            mocks.ReplayAll();

            FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
            var result = new NonAdoptableWithProfileProbabilityFailureMechanismSectionResult(section);

            result.Attach(observer);

            Func <FailureMechanismSectionAssemblyResultWrapper> performAssemblyFunc = FailureMechanismSectionAssemblyResultWrapperTestFactory.Create;
            var row = new NonAdoptableWithProfileProbabilityFailureMechanismSectionResultRow(result, errorProvider, performAssemblyFunc, ConstructionProperties);

            // Call
            setPropertyAction(row);

            // Assert
            Assert.AreEqual(newValue, assertPropertyFunc(result));

            mocks.VerifyAll();
        }