예제 #1
0
        public void TestRegisterAndResolveWithDependancies()
        {
            IContainer container = new Container()
                                   .Register <IFileSystemAdapter>(c => new FileSystemAdapter())
                                   .Register <IBuildDirectoryStructureService, BuildDirectoryStructureService>()
                                   .Register <ISimpleClassNoDependancies>(new SimpleClassNoDependancies());

            IBuildDirectoryStructureService service = container.Resolve <IBuildDirectoryStructureService>();

            Assert.IsNotNull(service);
            Assert.IsNotNull(service.FileSystemAdapter);
        }
예제 #2
0
파일: Ioc2.cs 프로젝트: ststeiger/SimpleIoc
 public static void Test()
 {
     IoC.Register <IFileSystemAdapter, FileSystemAdapter>();
     IoC.Register <IBuildDirectoryStructureService, BuildDirectoryStructureService>();
     IBuildDirectoryStructureService service = IoC.Resolve <IBuildDirectoryStructureService>();
 }