private static void AssertSortEquivalent(sort_attribute actual, IEnumerable <sort_attribute> expected) { var match = expected.Single(a => a.name == actual.name); Assert.That(actual.normalization.name, Is.EqualTo(match.normalization.name)); Assert.That(actual.type, Is.EqualTo(match.type)); }
public void AttributeSort() { const string name = "sortAttribute"; var attribute = _container.Resolve <AttributeConverter>() .Convert(new ConfigurationAttribute(name, type.@string, Present.No, sortOptions: new SortOptions(Normalization.DigitsLetters))); Assert.That(attribute.name, Is.EqualTo(name)); Assert.That(attribute.present, Is.Null); Assert.That(attribute.filter_attributes, Is.Not.Null); Assert.That(attribute.filter_attributes.Length, Is.EqualTo(0)); 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); var sort = new sort_attribute(); Assert.DoesNotThrow(() => sort = attribute.sort_attributes.Single()); Assert.That(sort.name, Is.EqualTo(name)); Assert.That(sort.normalization, Is.Not.Null); Assert.That(sort.normalization.name, Is.EqualTo("Keep digits and letters (e.g. Text123)")); Assert.That(sort.type, Is.EqualTo(type.@string)); }