Ejemplo n.º 1
0
        public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers()
        {
            // Setup
            const int numberOfChangedProperties = 3;
            var       mocks    = new MockRepository();
            var       observer = mocks.StrictMock <IObserver>();

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

            var chartLineData = new ChartLineData("Test", new ChartLineStyle
            {
                Color     = Color.AliceBlue,
                Width     = 3,
                DashStyle = ChartLineDashStyle.Solid
            });

            chartLineData.Attach(observer);

            var properties = new ChartLineDataProperties
            {
                Data = chartLineData
            };

            Color     newColor = Color.Blue;
            const int newWidth = 6;
            const ChartLineDashStyle newDashStyle = ChartLineDashStyle.DashDot;

            // Call
            properties.Color     = newColor;
            properties.Width     = newWidth;
            properties.DashStyle = newDashStyle;

            // Assert
            Assert.AreEqual(newColor, chartLineData.Style.Color);
            Assert.AreEqual(newWidth, chartLineData.Style.Width);
            Assert.AreEqual(newDashStyle, chartLineData.Style.DashStyle);
            mocks.VerifyAll();
        }