示例#1
0
        public void IndexSmokeTest_NotError()
        {
            // arrange
            var res = new IndexSmokeQuery
            {
                CountSigar = 10,
                AgeSmoke   = 10
            };


            // act
            var handler = new IndexSmokeHandler();
            var result  = handler.Handle(res).Result;

            // assert
            Assert.AreEqual(5, result.Index);
        }
示例#2
0
        public void IndexSmokeTest_MoreError()
        {
            // arrange
            var modelMore = new IndexSmokeQuery
            {
                CountSigar = 1000,
                AgeSmoke   = 151
            };

            // act
            var handler    = new IndexSmokeHandler();
            var errorModel = handler.Handle(modelMore).Exception.GetErrorListResponseFromException();

            // assert
            Assert.IsTrue(errorModel != null);
            Assert.IsTrue(errorModel.Errors.Count == 2);
            Assert.IsTrue(errorModel.Errors.Contains(IndexSmokeQueryValidator.AgeSmokeIncorrectMessage));
            Assert.IsTrue(errorModel.Errors.Contains(IndexSmokeQueryValidator.CountSigarIncorrectMessage));
        }
示例#3
0
 public async Task <IndexSmokeResponse> CalculateIndexSmoke(IndexSmokeQuery query)
 {
     return(await _indexSmokeHandler.Handle(query));
 }