Exemple #1
0
            public void ShouldDuckTypeIfThePassedObjectImplementsTheInterface()
            {
                // Arrange
                var di = new AnotherResolver();

                // Act
                Context.Initialize.SetDependencyResolver(di);

                // Assert
                Context.Resolve <DciContext>().Should().Be.Null();
                Context.ResolveAll <DciContext>().Count().Should().Equal(0);

                Context.Resolve <string>().Should().Equal("MockString");
                Context.ResolveAll <string>().Should().Equal(new[] { "MockString", "AnotherMockString" });

                Context.Resolve(typeof(string)).Should().Equal("MockString");
                Context.ResolveAll(typeof(string)).Should().Equal(new[] { "MockString", "AnotherMockString" });
            }
Exemple #2
0
            public void ShouldDuckTypeIfThePassedObjectImplementsTheInterface()
            {
                // Arrange
                var di = new AnotherResolver();

                // Act
                Context.Initialize.SetDependencyResolver(di);

                // Assert
                Context.Resolve<DciContext>().Should().Be.Null();
                Context.ResolveAll<DciContext>().Count().Should().Equal(0);

                Context.Resolve<string>().Should().Equal("MockString");
                Context.ResolveAll<string>().Should().Equal(new[] { "MockString", "AnotherMockString" });

                Context.Resolve(typeof(string)).Should().Equal("MockString");
                Context.ResolveAll(typeof(string)).Should().Equal(new[] { "MockString", "AnotherMockString" });
            }