Exemple #1
0
 public void ContextIsCloneable()
 {
   StandardContext ctx = new StandardContext();
   ctx.Add("string");
   var ctx2 = ctx.CloneContext();
   ctx2.Get<string>().ShouldBeTheSameAs(ctx.Get<string>());
 }
Exemple #2
0
 public void ContextCloneCanBeModifiedWithoutAffectingTheOriginal()
 {
   StandardContext ctx = new StandardContext();
   ctx.Add("horse");
   var ctx2 = ctx.CloneContext();
   ctx2.Replace("dog");
   ctx2.Add(new StringBuilder());
   ctx.Get<string>().ShouldBeTheSameAs("horse");
   ctx.Get<StringBuilder>().ShouldBeNull();
 }