Beispiel #1
0
        public void GetGreatestMultiple_WithValidOddNumber_ReturnsExpectedGreaterThanZero()
        {
            //Arrange
            var input    = 5;
            var expected = 0;
            var service  = new FactorServiceTestClassBuilder().Build();

            //Act
            var result = service.GetGreatestMultiple(input);

            //Assert
            result.Should().BeGreaterThan(expected, "because valid odd factors should return a positive number less than the default value of 1000");
        }
Beispiel #2
0
        public void GetGreatestMultiple_WithValidEvenNumber_ReturnsIntGreaterThanZero()
        {
            //Arrange
            var input    = 2;
            var expected = 0;
            var service  = new FactorServiceTestClassBuilder().Build();

            //Act
            var result = service.GetGreatestMultiple(input);

            //Assert
            result.Should().BeGreaterThan(expected, "because all valid input values should return a GetGreatestMultiple value greater than Zero");
        }
Beispiel #3
0
        public void GetGreatestMultiple_WithValidOddNumber_ReturnsExpectedLessThanConfigMaxValue()
        {
            var input    = 5;
            var maxValue = 1000;
            var minSum   = (maxValue / 2) - 1;
            var util     = Mock.CreateLike <IUtil>(config => config.MaxValue == maxValue && config.MaxInputValue == maxValue - 1 && config.MinSum == minSum);
            var service  = new FactorServiceTestClassBuilder().WithUtil(util).Build();

            //Act
            var result = service.GetGreatestMultiple(input);

            //Assert
            result.Should().BeLessThan(util.MaxValue, "because an odd number has remained that must be removed when finding the factor's greatest multiple");
        }
Beispiel #4
0
        public void GetGreatestMultiple_WithValidEvenNumber_ReturnsExpectedLessThanConfigMaxValue()
        {
            //Arrange
            var input    = 2;
            var maxValue = 1000;
            var minSum   = (maxValue / 2) - 1;
            var util     = Mock.CreateLike <IUtil>(config => config.MaxValue == maxValue && config.MaxInputValue == maxValue - 1 && config.MinSum == minSum);
            var service  = new FactorServiceTestClassBuilder().WithUtil(util).Build();

            //Act
            var result = service.GetGreatestMultiple(input);

            //Assert
            result.Should().BeLessThan(util.MaxValue, "because 2 is evenly divisible into 1000, it should return 998 as the Greatest Multiple");
        }