Exemplo n.º 1
0
        public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers()
        {
            // Setup
            const int numberOfChangedProperties = 1;

            var mocks    = new MockRepository();
            var observer = mocks.StrictMock <IObserver>();

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

            var chartData = new TestChartData("Test");

            chartData.Attach(observer);

            var properties = new TestChartDataProperties
            {
                Data = chartData
            };

            // Call
            properties.IsVisible = false;

            // Assert
            Assert.IsFalse(chartData.IsVisible);
            mocks.VerifyAll();
        }
Exemplo n.º 2
0
        public void Constructor_ReturnsExpectedValues()
        {
            // Call
            var properties = new TestChartDataProperties();

            Assert.IsInstanceOf <ObjectProperties <ChartData> >(properties);
            Assert.IsNull(properties.Data);
        }
Exemplo n.º 3
0
        public void Data_SetNewChartDataContextInstance_ReturnCorrectPropertyValues()
        {
            // Setup
            var chartData  = new TestChartData("TestChart");
            var properties = new TestChartDataProperties();

            // Call
            properties.Data = chartData;

            // Assert
            Assert.AreEqual(chartData.Name, properties.Name);
            Assert.AreEqual(chartData.IsVisible, properties.IsVisible);
            Assert.AreEqual("Test type string", properties.Type);
        }
Exemplo n.º 4
0
        public void Constructor_Always_PropertiesHaveExpectedAttributesValues()
        {
            // Setup
            var chartDataContext = new TestChartData("TestChart");

            // Call
            var properties = new TestChartDataProperties
            {
                Data = chartDataContext
            };

            // Assert
            PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);

            Assert.AreEqual(3, dynamicProperties.Count);

            const string generalCategory = "Algemeen";

            PropertyDescriptor nameProperty = dynamicProperties[namePropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty,
                                                                            generalCategory,
                                                                            "Naam",
                                                                            "De naam van deze gegevensreeks.",
                                                                            true);

            PropertyDescriptor typeProperty = dynamicProperties[typePropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(typeProperty,
                                                                            generalCategory,
                                                                            "Type",
                                                                            "Het type van de data die wordt weergegeven in de gegevensreeks.",
                                                                            true);

            PropertyDescriptor isVisibleProperty = dynamicProperties[visiblePropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(isVisibleProperty,
                                                                            generalCategory,
                                                                            "Weergeven",
                                                                            "Geeft aan of de gegevensreeks wordt weergegeven.");
        }