public void CanGetSpecificationsByBehavior() { var cache = new ElementCache(new ISpecificationElement[] { ElementFixtures.Specification1, ElementFixtures.Behavior1Specification1, ElementFixtures.Behavior1Specification2, ElementFixtures.Behavior2Specification1 }); var specifications1 = cache.GetSpecifications(ElementFixtures.Behavior1).ToArray(); var specifications2 = cache.GetSpecifications(ElementFixtures.Behavior2).ToArray(); Assert.That(specifications1, Has.Length.EqualTo(2)); Assert.That(specifications1, Contains.Item(ElementFixtures.Behavior1Specification1)); Assert.That(specifications1, Contains.Item(ElementFixtures.Behavior1Specification2)); Assert.That(specifications2, Has.Length.EqualTo(1)); Assert.That(specifications2, Contains.Item(ElementFixtures.Behavior2Specification1)); }
public void CanGetSpecificationsByContext() { var cache = new ElementCache(new ISpecificationElement[] { ElementFixtures.Specification1, ElementFixtures.Behavior1Specification1, ElementFixtures.Behavior1Specification2, ElementFixtures.Behavior2Specification1, }); var specifications = cache.GetSpecifications(ElementFixtures.Context).ToArray(); Assert.That(specifications, Has.Length.EqualTo(4)); Assert.That(specifications, Contains.Item(ElementFixtures.Specification1)); Assert.That(specifications, Contains.Item(ElementFixtures.Behavior1Specification1)); Assert.That(specifications, Contains.Item(ElementFixtures.Behavior1Specification2)); Assert.That(specifications, Contains.Item(ElementFixtures.Behavior2Specification1)); }