public void TestClassThrowsArgumentExceptionWhenClassNameIsNullOrEmpty( [Values] bool isNull) { string name = isNull ? null : string.Empty; 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); Assert.Throws( Is.TypeOf <ArgumentException>().And.Message .EqualTo("The name cannot be null or empty. (Parameter 'name')"), () => { // ReSharper disable once UnusedVariable INUnitFilterElement classElement = element.Class(name); }); }
public void TestClassSetsChildAndReturnsNewAndElementWithParent( [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 classElement = (INUnitFilterElementInternal)element.Class(name, isRegularExpression); Assert.IsNotNull(classElement); Assert.AreEqual(NUnitElementType.Class, classElement.ElementType); Assert.AreSame(element, classElement.Parent); Assert.AreSame(classElement, element.Child); Assert.AreEqual(name, classElement.ElementName); Assert.IsNull(classElement.ElementValue); Assert.AreEqual(isRegularExpression, classElement.IsRegularExpression); }