コード例 #1
0
ファイル: PropertyViewModelTest.cs プロジェクト: Kha/YUV.KA
		public void EnumerationPropertyViewModelTest()
		{
			// Since this property viewmodel commits its change as soon as the change is made, the commitChange method
			// is executed, which requires a working IoC
			IoC.GetInstance = IoCAggregator;

			PropertyViewModel en = new EnumerationPropertyViewModel();
			BlurNode blur = new BlurNode();
			blur.Type = BlurType.Linear;
			PropertyDescriptor pd = TypeDescriptor.GetProperties(blur).Find("Type", true);
			Assert.NotNull(pd);
			en.Initialize(blur, pd);

			// Test if binding to property was successful
			Assert.Equal("Type", en.DisplayName);
			Assert.Equal(((EnumerationPropertyViewModel)en).Choices, new[] { BlurType.Gaussian, BlurType.Linear });

			en.Value = BlurType.Gaussian;
			Assert.Equal(BlurType.Gaussian, blur.Type);
			en.Value = BlurType.Linear;
			Assert.Equal(BlurType.Linear, blur.Type);
		}
コード例 #2
0
        public void EnumerationPropertyViewModelTest()
        {
            // Since this property viewmodel commits its change as soon as the change is made, the commitChange method
            // is executed, which requires a working IoC
            IoC.GetInstance = IoCAggregator;

            PropertyViewModel en   = new EnumerationPropertyViewModel();
            BlurNode          blur = new BlurNode();

            blur.Type = BlurType.Linear;
            PropertyDescriptor pd = TypeDescriptor.GetProperties(blur).Find("Type", true);

            Assert.NotNull(pd);
            en.Initialize(blur, pd);

            // Test if binding to property was successful
            Assert.Equal("Type", en.DisplayName);
            Assert.Equal(((EnumerationPropertyViewModel)en).Choices, new[] { BlurType.Gaussian, BlurType.Linear });

            en.Value = BlurType.Gaussian;
            Assert.Equal(BlurType.Gaussian, blur.Type);
            en.Value = BlurType.Linear;
            Assert.Equal(BlurType.Linear, blur.Type);
        }