コード例 #1
0
 internal void Initialize(IAssertableProperties assertable)
 {
     this.assertable = assertable;
     if (null == properties)
     {
         properties = new RuntimeProperties();
         PropertyListView.ItemsSource = properties;
     }
 }
コード例 #2
0
ファイル: AddAssert.xaml.cs プロジェクト: samuto/designscript
        public AddAssert(IAssertableProperties assertable)
        {
            this.assertable = assertable;

            asserts = null;
            InitializeComponent();
            InitializeAssertWindow();
            propertiesList = new List<string>();
            BindPropertyListData();
            PropertyList.SelectionChanged += new SelectionChangedEventHandler(OnComboBoxSelectionChanged);
            AddButton.Click += new RoutedEventHandler(OnAddAssertButton);
        }
コード例 #3
0
        public AddAssert(IAssertableProperties assertable)
        {
            this.assertable = assertable;

            asserts = null;
            InitializeComponent();
            InitializeAssertWindow();
            propertiesList = new List <string>();
            BindPropertyListData();
            PropertyList.SelectionChanged += new SelectionChangedEventHandler(OnComboBoxSelectionChanged);
            AddButton.Click += new RoutedEventHandler(OnAddAssertButton);
        }
コード例 #4
0
        private void DoAssertions(List <CommandAssert> asserts)
        {
            IAssertableProperties assertable = textEditorCore.GetAssertableProperties();

            Type type = typeof(IAssertableProperties);

            foreach (CommandAssert assert in asserts)
            {
                string queriedValue = string.Empty;

                try
                {
                    PropertyInfo property      = type.GetProperty(assert.PropertyName);
                    object       propertyValue = (property.GetValue(assertable, null));
                    queriedValue = propertyValue.ToString();
                }
                catch (Exception exception)
                {
                    queriedValue = exception.Message;
                }
                finally
                {
                    if (queriedValue == assert.PropertyValue)
                    {
                        string result = "Property: " + assert.PropertyName + '\n' +
                                        "Expected: " + assert.PropertyValue + '\n' +
                                        "Actual: " + queriedValue + '\n';

                        assert.Passed = true;
                        assertions.Add(new AssertionResult("Pass", assert.AssertNumber.ToString(), result));
                    }
                    else
                    {
                        string result = "Property: " + assert.PropertyName + '\n' +
                                        "Expected: " + assert.PropertyValue + '\n' +
                                        "Actual: " + queriedValue + '\n';

                        assert.Passed = false;
                        assertions.Add(new AssertionResult("Fail", assert.AssertNumber.ToString(), result));
                    }
                }
            }
        }