示例#1
0
        public void close_an_open_type()
        {
            var argument = new Argument
            {
                Type = typeof(IService<>),
                Dependency = new ConfiguredInstance(typeof(Service<>)),
                Name = "foo"
            };

            var closed = argument.CloseType(typeof(int));

            closed.Type.ShouldBe(typeof(IService<int>));
            closed.Dependency.ShouldBeOfType<ConstructorInstance>()
                .PluggedType.ShouldBe(typeof(Service<int>));
            closed.Name.ShouldBe("foo");
        }
示例#2
0
        public void close_an_already_closed_type_just_clones_2()
        {
            var argument = new Argument
            {
                Type = typeof(IGateway),
                Dependency = new ConstructorInstance(typeof(StubbedGateway)),
                Name = "Foo"
            };

            var closed = argument.CloseType(typeof(int));
            closed.ShouldNotBeTheSameAs(argument);

            closed.Type.ShouldBe(argument.Type);
            closed.Dependency.ShouldBe(argument.Dependency);
            closed.Name.ShouldBe(argument.Name);
        }