public void BuildChecksConcreteTypeAndNotRequestedType() { BuilderAwareStrategy strategy = new BuilderAwareStrategy(); MockBuilderContext context = new MockBuilderContext(); AwareObject obj = new AwareObject(); context.InnerChain.Add(strategy); context.HeadOfChain.BuildUp(context, typeof(IgnorantObject), obj, null); Assert.IsTrue(obj.OnAssembledCalled); Assert.IsFalse(obj.OnDisassemblingCalled); }
public void UnbuildCallsClassWithInterface() { BuilderAwareStrategy strategy = new BuilderAwareStrategy(); MockBuilderContext context = new MockBuilderContext(); AwareObject obj = new AwareObject(); context.InnerChain.Add(strategy); context.HeadOfChain.TearDown(context, obj); Assert.IsFalse(obj.OnAssembledCalled); Assert.IsTrue(obj.OnDisassemblingCalled); }
public void BuildCallsClassWithInterface() { BuilderAwareStrategy strategy = new BuilderAwareStrategy(); MockBuilderContext context = new MockBuilderContext(); AwareObject obj = new AwareObject(); context.InnerChain.Add(strategy); context.HeadOfChain.BuildUp(context, typeof(AwareObject), obj, "foo"); Assert.IsTrue(obj.OnAssembledCalled); Assert.IsFalse(obj.OnDisassemblingCalled); Assert.AreEqual("foo", obj.AssembledID); }