public void BuildUpClassWithNestedClassDependencyMethod_Success() { var c = new Container(); c.RegisterType<EmptyClass>(); c.RegisterType<SampleClassWithClassDependencyMethod>(); var sampleClass = new SampleClassWithNestedClassDependencyMethod(); c.BuildUp(sampleClass, ResolveKind.PartialEmitFunction); Assert.IsNotNull(sampleClass.SampleClassWithClassDependencyMethod); Assert.IsNotNull(sampleClass.SampleClassWithClassDependencyMethod.EmptyClass); }
public void DifferentObjects_BuildUpClassWithNestedClassDependencyMethod_Success() { var c = new Container(); c.RegisterType<EmptyClass>(); c.RegisterType<SampleClassWithClassDependencyMethod>(); var sampleClass1 = new SampleClassWithNestedClassDependencyMethod(); var sampleClass2 = new SampleClassWithNestedClassDependencyMethod(); c.BuildUp(sampleClass1, ResolveKind.PartialEmitFunction); c.BuildUp(sampleClass2, ResolveKind.PartialEmitFunction); Assert.IsNotNull(sampleClass1.SampleClassWithClassDependencyMethod); Assert.IsNotNull(sampleClass1.SampleClassWithClassDependencyMethod.EmptyClass); Assert.IsNotNull(sampleClass2.SampleClassWithClassDependencyMethod); Assert.IsNotNull(sampleClass2.SampleClassWithClassDependencyMethod.EmptyClass); Assert.AreNotEqual(sampleClass1, sampleClass2); Assert.AreNotEqual(sampleClass1.SampleClassWithClassDependencyMethod, sampleClass2.SampleClassWithClassDependencyMethod); Assert.AreNotEqual(sampleClass1.SampleClassWithClassDependencyMethod.EmptyClass, sampleClass2.SampleClassWithClassDependencyMethod.EmptyClass); }