public void AttributeFilter() { const string name = "filterAttribute"; var attribute = _container.Resolve <AttributeConverter>() .Convert(new ConfigurationAttribute(name, type.@string, Present.No, filterOptions: new FilterOptions(Format.CommaSeparated, Tokenization.ModelDesignation))); Assert.That(attribute.name, Is.EqualTo(name)); Assert.That(attribute.present, Is.Null); Assert.That(attribute.search_attributes, Is.Not.Null); Assert.That(attribute.search_attributes.Length, Is.EqualTo(0)); Assert.That(attribute.sort_attributes, Is.Not.Null); Assert.That(attribute.sort_attributes.Length, Is.EqualTo(0)); Assert.That(attribute.filter_attributes, Is.Not.Null); var filter = new filter_attribute(); Assert.DoesNotThrow(() => filter = attribute.filter_attributes.Single()); Assert.That(filter.format, Is.Not.Null); Assert.That(filter.format.name, Is.EqualTo("Comma-separated list (e.g. a,b,c)")); Assert.That(filter.name, Is.EqualTo(name)); Assert.That(filter.tokenization, Is.Not.Null); Assert.That(filter.tokenization.name, Is.EqualTo("Model designation (e.g. MB12a)")); Assert.That(filter.type, Is.EqualTo(type.@string)); }
private static void AssertFiltersEquivalent(filter_attribute actual, IEnumerable <filter_attribute> expected) { var match = expected.Single(a => a.name == actual.name); Assert.That(actual.type, Is.EqualTo(match.type)); Assert.That(actual.format.name, Is.EqualTo(match.format.name)); Assert.That(actual.tokenization.name, Is.EqualTo(match.tokenization.name)); }