Beispiel #1
0
 /// <summary>
 /// Initializes the new empty trait of a Context.
 /// </summary>
 internal MultiTrait(MultiTraitContext ctx)
 {
     Debug.Assert(ctx.EmptyTrait == null, "There is only one empty trait per context.");
     _context   = ctx;
     _trait     = String.Empty;
     _traits    = ReadOnlyListEmpty <MultiTrait> .Empty;
     _fallbacks = new ReadOnlyListMono <MultiTrait>(this);
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new atomic trait.
 /// </summary>
 internal MultiTrait(MultiTraitContext ctx, string atomicTrait)
 {
     Debug.Assert(atomicTrait.Contains('+') == false);
     _context   = ctx;
     _trait     = atomicTrait;
     _traits    = new ReadOnlyListMono <MultiTrait>(this);
     _fallbacks = ctx.EmptyTrait.Fallbacks;
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new combined trait.
 /// </summary>
 internal MultiTrait(MultiTraitContext ctx, string combinedTrait, IReadOnlyList <MultiTrait> traits)
 {
     Debug.Assert(combinedTrait.IndexOf('+') > 0 && traits.Count > 1, "There is more than one trait in a Combined Trait.");
     Debug.Assert(traits.All(m => m.IsAtomic), "Provided traits are all atomic.");
     Debug.Assert(traits.GroupBy(m => m).Where(g => g.Count() != 1).Count() == 0, "No duplicate in atomic in traits.");
     _context = ctx;
     _trait   = combinedTrait;
     _traits  = traits;
 }
Beispiel #4
0
 public void Setup()
 {
     Context = new MultiTraitContext();
 }