public void TestPropertyThrowsArgumentExceptionWhenPropertyValueIsNullOrEmpty( [Values] bool isNull) { const string name = "name_1"; string value = isNull ? null : string.Empty; const string xmlTag = "parent_1"; XmlSerializableElementForTest parent = new XmlSerializableElementForTest(xmlTag, value, NUnitElementType.Test); INUnitFilterContainerElementInternal element = new NUnitFilterContainerElement(parent, NUnitElementType.And); Assert.Throws( Is.TypeOf <ArgumentException>().And.Message .EqualTo("The value cannot be null or empty. (Parameter 'value')"), () => { // ReSharper disable once UnusedVariable INUnitFilterElement property = element.Property(name, value); }); }
public void TestPropertySetsChildAndReturnsNewAndElementWithParent( [Values] bool isRegularExpression) { const string name = "name_1"; const string value = "Value_1"; const string xmlTag = "parent_1"; XmlSerializableElementForTest parent = new XmlSerializableElementForTest(xmlTag, value, NUnitElementType.Test); INUnitFilterContainerElementInternal element = new NUnitFilterContainerElement(parent, NUnitElementType.And); INUnitFilterElementInternal property = (INUnitFilterElementInternal)element.Property(name, value, isRegularExpression); Assert.IsNotNull(property); Assert.AreEqual(NUnitElementType.Property, property.ElementType); Assert.AreSame(element, property.Parent); Assert.AreSame(property, element.Child); Assert.AreEqual(name, property.ElementName); Assert.AreEqual(value, property.ElementValue); Assert.AreEqual(isRegularExpression, property.IsRegularExpression); }