Inheritance: ISimpleTestService
コード例 #1
0
ファイル: ContainerCoreTests.cs プロジェクト: andlju/Petite
        public void Instance_Registration_Returns_Given_Instance_Every_Resolve()
        {
            var target   = new Container();
            var instance = new SimpleTestService();

            target.RegisterInstance <ISimpleTestService>("Name", instance);

            var resolvedFirst  = target.Resolve <ISimpleTestService>("Name");
            var resolvedSecond = target.Resolve <ISimpleTestService>("Name");

            Assert.AreSame(instance, resolvedFirst);
            Assert.AreSame(instance, resolvedSecond);
        }
コード例 #2
0
ファイル: ContainerCoreTests.cs プロジェクト: andlju/Petite
        public void Instance_Registration_Returns_Given_Instance_Every_Resolve()
        {
            var target = new Container();
            var instance = new SimpleTestService();
            target.RegisterInstance<ISimpleTestService>("Name", instance);

            var resolvedFirst = target.Resolve<ISimpleTestService>("Name");
            var resolvedSecond = target.Resolve<ISimpleTestService>("Name");

            Assert.AreSame(instance, resolvedFirst);
            Assert.AreSame(instance, resolvedSecond);
        }