Exemple #1
0
        public void GetPositionOfFuncConstructorAgumentReturnsZeroIfTheOnlyArgument()
        {
            var funcConstructorArgument = new FuncConstructorArgument(typeof(int), 2, null);
            var context = CreateContext(funcConstructorArgument);
            var target  = CreateTarget(typeof(int), "x");

            var value = this.testee.GetPositionOfFuncConstructorArgument(funcConstructorArgument, context, target);

            value.Should().Be(0);
        }
        public void GetPositionOfFuncConstructorAgumentReturnsZeroIfTheOnlyArgument()
        {
            var funcConstructorArgument = new FuncConstructorArgument(typeof(int), 2, null);
            var context = CreateContext(funcConstructorArgument);
            var target = CreateTarget(typeof(int), "x");

            var value = this.testee.GetPositionOfFuncConstructorArgument(funcConstructorArgument, context, target);

            value.Should().Be(0);
        }
Exemple #3
0
        public void GetPositionOfFuncConstructorAgumentReturnsMinusOneIfNotFound()
        {
            var funcConstructorArgument = new FuncConstructorArgument(typeof(int), 2, null);
            var context = CreateContext();
            var target  = CreateTarget(typeof(int), "x");

            var value = this.testee.GetPositionOfFuncConstructorArgument(funcConstructorArgument, context, target);

            value.Should().Be(-1);
        }
        public void GetPositionOfFuncConstructorAgumentReturnsMinusOneIfNotFound()
        {
            var funcConstructorArgument = new FuncConstructorArgument(typeof(int), 2, null);
            var context = CreateContext();
            var target = CreateTarget(typeof(int), "x");

            var value = this.testee.GetPositionOfFuncConstructorArgument(funcConstructorArgument, context, target);

            value.Should().Be(-1);
        }
Exemple #5
0
        public void GetPositionOfFuncConstructorAgumentIfNoneFuncConstructorArgumentAppliesToTargetMinusOneIsReturned()
        {
            var funcConstructorArgument = new FuncConstructorArgument(typeof(int), 2, null);
            var constsuctorArgumentMock = new Mock <IConstructorArgument>();
            var context = CreateContext(
                funcConstructorArgument,
                constsuctorArgumentMock.Object);
            var target = CreateTarget(typeof(int), "x");

            constsuctorArgumentMock.Setup(constsuctorArgument => constsuctorArgument.AppliesToTarget(context, target)).Returns(true);

            var value = this.testee.GetPositionOfFuncConstructorArgument(funcConstructorArgument, context, target);

            value.Should().Be(-1);
        }
Exemple #6
0
        public void GetPositionOfFuncConstructorAgumentReturnsPositionOfTheGivenInstanceWithinAllFuncConstructorArgumentsOfTheSameType()
        {
            var funcConstructorArgument = new FuncConstructorArgument(typeof(int), 2, null);
            var context = CreateContext(
                new FuncConstructorArgument(typeof(int), 2, null),
                new FuncConstructorArgument(typeof(int), 2, null),
                new FuncConstructorArgument(typeof(string), "e", null),
                new FuncConstructorArgument(typeof(double), 2, null),
                new FuncConstructorArgument(typeof(int), 2, null),
                funcConstructorArgument,
                new FuncConstructorArgument(typeof(int), 2, null),
                new FuncConstructorArgument(typeof(string), "w", null),
                new FuncConstructorArgument(typeof(int), 2, null));
            var target = CreateTarget(typeof(int), "x");

            var value = this.testee.GetPositionOfFuncConstructorArgument(funcConstructorArgument, context, target);

            value.Should().Be(3);
        }
        public void GetPositionOfFuncConstructorAgumentReturnsPositionOfTheGivenInstanceWithinAllFuncConstructorArgumentsOfTheSameType()
        {
            var funcConstructorArgument = new FuncConstructorArgument(typeof(int), 2, null);
            var context = CreateContext(
                new FuncConstructorArgument(typeof(int), 2, null),
                new FuncConstructorArgument(typeof(int), 2, null),
                new FuncConstructorArgument(typeof(string), "e", null),
                new FuncConstructorArgument(typeof(double), 2, null),
                new FuncConstructorArgument(typeof(int), 2, null),
                funcConstructorArgument,
                new FuncConstructorArgument(typeof(int), 2, null),
                new FuncConstructorArgument(typeof(string), "w", null),
                new FuncConstructorArgument(typeof(int), 2, null));
            var target = CreateTarget(typeof(int), "x");

            var value = this.testee.GetPositionOfFuncConstructorArgument(funcConstructorArgument, context, target);

            value.Should().Be(3);
        }
        public void GetPositionOfFuncConstructorAgumentIfNoneFuncConstructorArgumentAppliesToTargetMinusOneIsReturned()
        {
            var funcConstructorArgument = new FuncConstructorArgument(typeof(int), 2, null);
            var constsuctorArgumentMock = new Mock<IConstructorArgument>();
            var context = CreateContext(
                funcConstructorArgument,
                constsuctorArgumentMock.Object);
            var target = CreateTarget(typeof(int), "x");
            constsuctorArgumentMock.Setup(constsuctorArgument => constsuctorArgument.AppliesToTarget(context, target)).Returns(true);

            var value = this.testee.GetPositionOfFuncConstructorArgument(funcConstructorArgument, context, target);

            value.Should().Be(-1);
        }
 public FuncConstructorArgumentTests()
 {
     this.argumentPositionCalculatorMock = new Mock <IArgumentPositionCalculator>();
     this.testee = new FuncConstructorArgument(typeof(int), 4, this.argumentPositionCalculatorMock.Object);
 }
 public FuncConstructorArgumentTests()
 {
     this.argumentPositionCalculatorMock = new Mock<IArgumentPositionCalculator>();
     this.testee = new FuncConstructorArgument(typeof(int), 4, this.argumentPositionCalculatorMock.Object);
 }