public void SetProperties_WithData_UpdateDataAndNotifyObservers()
        {
            // Setup
            var mocks           = new MockRepository();
            var projectObserver = mocks.StrictMock <IObserver>();

            projectObserver.Expect(o => o.UpdateObserver());
            var failureMechanism = mocks.StrictMock <ICalculatableFailureMechanism>();

            mocks.ReplayAll();

            var calculationGroup            = new CalculationGroup();
            var testCalculationGroupContext = new TestCalculationGroupContext(calculationGroup, new CalculationGroup(), failureMechanism);

            calculationGroup.Attach(projectObserver);

            // Call
            var properties = new CalculationGroupContextProperties(testCalculationGroupContext);

            // Assert
            const string name = "cool new name!";

            properties.Name = name;
            Assert.AreEqual(name, calculationGroup.Name);
            mocks.VerifyAll();
        }
        public void OnNodeRemoved_ParentIsCalculationGroupContext_RemoveCalculationFromGroup()
        {
            // Setup
            var observer = mocks.StrictMock <IObserver>();

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

            var elementToBeRemoved = new MacroStabilityInwardsCalculationScenario();

            var group = new CalculationGroup();

            group.Children.Add(elementToBeRemoved);
            group.Children.Add(new MacroStabilityInwardsCalculationScenario());
            group.Attach(observer);

            var failureMechanism  = new MacroStabilityInwardsFailureMechanism();
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            mocks.ReplayAll();

            var calculationContext = new MacroStabilityInwardsCalculationScenarioContext(elementToBeRemoved,
                                                                                         group,
                                                                                         Enumerable.Empty <MacroStabilityInwardsSurfaceLine>(),
                                                                                         Enumerable.Empty <MacroStabilityInwardsStochasticSoilModel>(),
                                                                                         failureMechanism,
                                                                                         assessmentSection);
            var groupContext = new MacroStabilityInwardsCalculationGroupContext(group,
                                                                                null,
                                                                                Enumerable.Empty <MacroStabilityInwardsSurfaceLine>(),
                                                                                Enumerable.Empty <MacroStabilityInwardsStochasticSoilModel>(),
                                                                                failureMechanism,
                                                                                assessmentSection);

            // Precondition
            Assert.IsTrue(info.CanRemove(calculationContext, groupContext));
            Assert.AreEqual(2, group.Children.Count);

            // Call
            info.OnNodeRemoved(calculationContext, groupContext);

            // Assert
            Assert.AreEqual(1, group.Children.Count);
            CollectionAssert.DoesNotContain(group.Children, elementToBeRemoved);
        }