Пример #1
0
        public void TestAgencyMarkupNoExistingAgencyMarkupFail()
        {
            _iMasterDataAgencyMarkupMock.Setup(x => x.GetList()).Returns(Task.FromResult(new BaseResult <List <Core.Model.MasterData.AgencyMarkup> > {
                Result = ExistingMasterDataMarkup(), IsError = false
            }));
            _iMarkupDataAgencyMarkupRuleMock.Setup(x => x.GetList()).Returns(Task.FromResult(new BaseResult <List <AgencyMarkupRule> > {
                Result = new List <AgencyMarkupRule>(), IsError = false
            }));

            Models.Request.AgencyMarkup model = RequestModel();
            model.AgencyMarkupRule.Add(new AgencyMarkupRule()
            {
                ChargeTypeId    = 1,
                CityId          = 1,
                CountryId       = 1,
                FromDatekey     = 20180106,
                HotelId         = 1,
                Markup          = 11,
                HotelRoomTypeId = 1,
                Id            = 1,
                IsActive      = true,
                IsDeleted     = false,
                MarkupId      = 1,
                NationalityId = 1,
                AgencyId      = 1,
                ToDatekey     = 20180107
            });

            var result = agencyMarkupControllerMock.Create(model).Result;

            Assert.IsTrue(result is BadRequestObjectResult);
            Assert.AreEqual(((BadRequestObjectResult)result).StatusCode, 400);
        }
Пример #2
0
        public void TestAgencyMarkUpDuplicateMarkupNameFail()
        {
            _iMasterDataAgencyMarkupMock.Setup(x => x.GetList()).Returns(Task.FromResult(new BaseResult <List <Core.Model.MasterData.AgencyMarkup> > {
                Result = ExistingMasterDataMarkup(), IsError = false
            }));
            _iMarkupDataAgencyMarkupRuleMock.Setup(x => x.GetList()).Returns(Task.FromResult(new BaseResult <List <AgencyMarkupRule> > {
                Result = ExistingMarkupRules(), IsError = false
            }));

            Models.Request.AgencyMarkup model = RequestModel();
            model.MGAgencyMarkup.Name = "Markup";

            var result = agencyMarkupControllerMock.Create(model).Result;

            Assert.IsTrue(result is BadRequestObjectResult);
            Assert.AreEqual(((BadRequestObjectResult)result).StatusCode, 400);
        }