public void PrepareBoundaryAspects_ShouldRemove_DuplicatedAspects() { // Arrange var declarations = new [] { MethodAspectDeclaration <MethodBoundaryAspect> .FromType(new ReturnDefaultValueAspect(BoundaryType.Entry) { Order = 0 }, null), MethodAspectDeclaration <MethodBoundaryAspect> .FromType(new ObservableAspect { Order = 2 }, null), MethodAspectDeclaration <MethodBoundaryAspect> .FromMethod(new ObservableAspect { Order = 1 }, null), }; var collector = CreateAspectCollector(declarations); var orderer = CreateAspectOrderStrategy <MethodBoundaryAspect, int>(a => a.Order); var dependencySelector = CreateAspectDependencySelector(); var finalizer = CreateAspectFinalizer(); var factory = new AspectFactory( collector.ToInstanceHolder(), orderer.ToInstanceHolder(), dependencySelector.ToInstanceHolder(), finalizer.ToInstanceHolder()); // Act var aspects = factory.CreateBoundaryAspects(signature: null); // Assert Assert.Equal(2, aspects.Length); Assert.Equal(declarations.ElementAt(0).MethodAspect, aspects.ElementAt(0)); // 1й был удален. тк. его приоритет ниже Assert.Equal(declarations.ElementAt(2).MethodAspect, aspects.ElementAt(1)); }