예제 #1
0
        public void Create1()
        {
            ServiceRepository repo = new ServiceRepository();

            var svc1 = new Service1A();

            repo.Register(svc1);

            var svc3 = repo.Create <Service3>();

            Assert.That(svc3, Is.Not.Null);
            Assert.That(svc3.Svc1, Is.SameAs(svc1));
        }
예제 #2
0
        public void Create1_NonGeneric()
        {
            ServiceRepository repo = new ServiceRepository();

            var svc1 = new Service1A();

            repo.Register(svc1);

            var svc3 = repo.Create(typeof(Service3));

            Assert.That(svc3, Is.Not.Null);
            Assert.That(svc3, Is.InstanceOf <Service3>());
            Assert.That(((Service3)svc3).Svc1, Is.SameAs(svc1));
        }