コード例 #1
0
        public void SortMixins_SortsAccordingToDependencies_OrderingFullyDefinedByDependencies()
        {
            // NullMixin2 -> NullMixin3 -> NullMixin
            var targetClassDefinition = CreateTargetClassDefinition(
                Tuple.Create(typeof(NullMixin), false, Type.EmptyTypes),
                Tuple.Create(typeof(NullMixin2), false, new[] { typeof(NullMixin3) }),
                Tuple.Create(typeof(NullMixin3), false, new[] { typeof(NullMixin) }));

            var result = _sorter.SortMixins(targetClassDefinition.Mixins);

            CheckResult(result, typeof(NullMixin2), typeof(NullMixin3), typeof(NullMixin));
        }
コード例 #2
0
 private ICollection <MixinDefinition> SortMixins(TargetClassDefinition targetClassDefinition)
 {
     try
     {
         return(_mixinSorter.SortMixins(targetClassDefinition.Mixins).ConvertToCollection());
     }
     catch (InvalidOperationException ex)
     {
         string message = string.Format(
             "The mixins applied to target class '{0}' cannot be ordered. {1}",
             targetClassDefinition.FullName,
             ex.Message);
         throw new ConfigurationException(message, ex);
     }
 }