示例#1
0
        public void MonnerotFormulaTest_LessOrMoreHeightAndWristLengthError()
        {
            // arrange
            var modelLess = new MonnerotFormulaQuery
            {
                WristLength = 2,
                Height      = 139
            };

            var modelMore = new MonnerotFormulaQuery
            {
                WristLength = 51,
                Height      = 351
            };

            // act
            var handler             = new MonnerotFormulaHandler();
            var resultLessException = handler.Handle(modelLess).Exception;
            var errorModel1         = resultLessException.GetErrorListResponseFromException();

            var resultMoreException = handler.Handle(modelMore).Exception;
            var errorModel2         = resultMoreException.GetErrorListResponseFromException();

            // assert
            Assert.IsTrue(errorModel1 != null);
            Assert.IsTrue(errorModel1.Errors.Count == 2);
            Assert.IsTrue(errorModel1.Errors.Contains(MonnerotFormulaQueryValidator.HeightIncorrectMessage));
            Assert.IsTrue(errorModel1.Errors.Contains(MonnerotFormulaQueryValidator.WristLengthIncorrectMessage));

            Assert.IsTrue(errorModel2 != null);
            Assert.IsTrue(errorModel2.Errors.Count == 2);
            Assert.IsTrue(errorModel2.Errors.Contains(MonnerotFormulaQueryValidator.HeightIncorrectMessage));
            Assert.IsTrue(errorModel2.Errors.Contains(MonnerotFormulaQueryValidator.WristLengthIncorrectMessage));
        }
示例#2
0
        public void MonnerotFormulaTest_NotError()
        {
            // arrange
            var model = new MonnerotFormulaQuery
            {
                WristLength = 17,
                Height      = 180
            };

            // act
            var handler = new MonnerotFormulaHandler();
            var result  = handler.Handle(model).Result;

            // assert
            Assert.AreEqual(74, result.CalculationResult);
        }
示例#3
0
 public MonnerotFormulaController(MonnerotFormulaHandler handler)
 {
     _handler = handler;
 }