예제 #1
0
        public void IndexBrokaTest_HeightLittleOrMoreError()
        {
            // arrange
            var modelLittle = new IndexBrokaQuery
            {
                Height = 150,
                IsMen  = true
            };

            var modelMore = new IndexBrokaQuery
            {
                Height = 190,
                IsMen  = false
            };

            // act
            var handler = new IndexBrokaHandler();
            var result1 = handler.Handle(modelLittle).Exception;
            var result2 = handler.Handle(modelMore).Exception;

            var errorModel1 = result1.GetErrorListResponseFromException();
            var errorModel2 = result2.GetErrorListResponseFromException();

            // assert
            Assert.IsTrue(errorModel1 != null);
            Assert.IsTrue(errorModel1.Errors.Count == 1);
            Assert.IsTrue(errorModel1.Errors.Contains(IndexBrokaQueryValidator.HeightIncorrectMessage));

            Assert.IsTrue(errorModel2 != null);
            Assert.IsTrue(errorModel2.Errors.Count == 1);
            Assert.IsTrue(errorModel2.Errors.Contains(IndexBrokaQueryValidator.HeightIncorrectMessage));
        }
예제 #2
0
        public void IndexBrokaTest_NotError()
        {
            // arrange
            var model = new IndexBrokaQuery
            {
                Height = 180,
                IsMen  = true
            };

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


            // assert
            Assert.AreEqual(90, result.CalculationResult);
        }
예제 #3
0
 public async Task <IndexBrokaResponse> Calculate(IndexBrokaQuery query)
 {
     return(await _handler.Handle(query));
 }