Ejemplo n.º 1
0
        public void ShouldNotMatch_Blue_White()
        {
            //assign
            IColor white     = new ColorWhite();
            IColor blueColor = new ColorBlue();
            //act
            bool matches = blueColor.Matches(white);

            //assert
            matches.Should().BeFalse();
        }
Ejemplo n.º 2
0
        public void ShouldNotMatch_Blue_Red()
        {
            //assign
            IColor redColor  = new ColorRed();
            IColor blueColor = new ColorBlue();
            //act
            bool matches = blueColor.Matches(redColor);

            //assert
            matches.Should().BeFalse();
        }
Ejemplo n.º 3
0
        public void ShouldNotMatch_Blue_Green()
        {
            //assign
            IColor blue  = new ColorBlue();
            IColor green = new ColorGreen();
            //act
            bool matches = blue.Matches(green);

            //assert
            matches.Should().BeFalse();
        }
Ejemplo n.º 4
0
        public void ShouldMatch_Blue_Blue()
        {
            //assign
            IColor blueColor2 = new ColorBlue();
            IColor blueColor1 = new ColorBlue();
            //act
            bool matches = blueColor1.Matches(blueColor2);

            //assert
            matches.Should().BeTrue();
        }
        public void Register_Instance_Transient_NotThrow()
        {
            var container    = Container.Create();
            var instanceBlue = new ColorBlue();

            container.Register(Scope.Transient, instanceBlue);

            container.ThrowIfNotResolved();

            Assert.Pass();
        }
Ejemplo n.º 6
0
        public void Resolve_Transient_All_Instances_Different()
        {
            const int EXPECTED_COUNT = 2;

            var container = Container.Create();

            var colorRed  = new ColorRed();
            var colorBlue = new ColorBlue();

            container.Register <IColor, ColorRed>(Scope.Transient, colorRed);
            container.Register <IColor, ColorBlue>(Scope.Transient, colorBlue);

            var colors      = container.ResolveAll <IColor>();
            var actualCount = colors.Length;

            Assert.AreEqual(EXPECTED_COUNT, actualCount);
            Assert.AreNotEqual(colors[0], colors[1]);
        }