public void Roll_GivenInvalidParameters_ExpectBadRequest()
        {
            var errorResponse = new RollerDomainResponse(null, false, "Error!");

            roller
            .Setup(r => r.Roll(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>()))
            .Returns(errorResponse);

            var result = sut.Roll(5);

            Assert.That(result, Is.TypeOf(typeof(BadRequestObjectResult)));
        }
        public void Roll_GivenMultiVerboseRoll_ExpectWebResponseEnumerable()
        {
            var multiRollResponse = new RollerDomainResponse(multiRollAttemptList, true, string.Empty);

            roller
            .Setup(r => r.Roll(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>()))
            .Returns(multiRollResponse);

            var result = sut.Roll(6, 1, 0, 2, true);

            Assert.That(result, Is.TypeOf(typeof(OkObjectResult)));
            var okResult = result as OkObjectResult;

            Assert.That(okResult.Value, Is.TypeOf(typeof(List <DiceRollerWebResponse>)), "multi-attempt verbose rolls should return a list of DiceRollerWebResponses");
        }
        public void Roll_GivenSingleVerboseRoll_ExpectWebResponse()
        {
            var singleRollResponse = new RollerDomainResponse(singleRollAttemptList, true, string.Empty);

            roller
            .Setup(r => r.Roll(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>()))
            .Returns(singleRollResponse);

            var result = sut.Roll(6, 1, 0, 1, true);

            Assert.That(result, Is.TypeOf(typeof(OkObjectResult)));
            var okResult = result as OkObjectResult;

            Assert.That(okResult.Value, Is.TypeOf(typeof(DiceRollerWebResponse)), "verbose rolls should return an DiceRollerWebResponse");
        }
        public void Roll_GivenValidMultipleAttempt_ExpectEnumerableOfInts()
        {
            var multiRollResponse = new RollerDomainResponse(multiRollAttemptList, true, string.Empty);

            roller
            .Setup(r => r.Roll(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>()))
            .Returns(multiRollResponse);

            var result = sut.Roll(6, 1, 0, 2);

            Assert.That(result, Is.TypeOf(typeof(OkObjectResult)));
            var okResult = result as OkObjectResult;

            Assert.That(okResult.Value, Is.TypeOf(typeof(List <int>)), "multi-attempt, non-verbose rolls should return a list of numbers");
        }
        public void Roll_GivenValidSingleAttempt_ExpectNumber()
        {
            var singleRollResponse = new RollerDomainResponse(singleRollAttemptList, true, string.Empty);

            roller
            .Setup(r => r.Roll(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>()))
            .Returns(singleRollResponse);

            var result = sut.Roll(6);

            Assert.That(result, Is.TypeOf(typeof(OkObjectResult)));
            var okResult = result as OkObjectResult;

            Assert.That(okResult.Value, Is.TypeOf(typeof(int)), "single, non-verbose rolls should return a numeric value");
        }