internal void Initialize(IAssertableProperties assertable) { this.assertable = assertable; if (null == properties) { properties = new RuntimeProperties(); PropertyListView.ItemsSource = properties; } }
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); }
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); }
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)); } } } }