コード例 #1
0
        public void GetFizzBuzzData_ShouldReturnBuzz_WhenInputNumberIs5(int inputValue, string expectedResult)
        {
            this.ruleMock = new Mock <IRule>();

            this.ruleMock.Setup(x => x.IsDivisible(inputValue)).Returns(true);

            this.ruleMock.Setup(y => y.GetValue()).Returns(Constants.Buzz);

            var businesrule = new[]
            {
                this.ruleMock.Object
            };
            var results = new FizzBuzzService(businesrule);

            var actual = results.GetFizzBuzzData(inputValue);

            Assert.AreEqual(actual[4], expectedResult);
        }
コード例 #2
0
        public void GetFizzBuzzDataTest(int inputValue, string[] expectedResult)
        {
            this.ruleMock = new Mock <IRule>();

            this.ruleMock.Setup(x => x.IsDivisible(inputValue)).Returns(false);

            this.ruleMock.Setup(y => y.GetValue()).Returns(string.Empty);

            var businesrule = new[]
            {
                this.ruleMock.Object,
                this.ruleMock.Object
            };
            var results = new FizzBuzzService(businesrule);

            var actual = results.GetFizzBuzzData(inputValue);

            Assert.AreEqual(actual, expectedResult);
        }