Example #1
0
        public async Task InsertEPSMappingTest_Success()
        {
            MockEPSMappingApiRepository bApi        = new MockEPSMappingApiRepository();
            IDistributedCache           _cache      = FakeCache();
            IOptions <Settings>         appSettings = Substitute.For <IOptions <Settings> >();
            IEPSMappingApi       epsMappingApi      = new EPSMappingApi(appSettings, bApi);
            EPSMappingController controller         = FakeController(_cache, epsMappingApi);
            EPSMapping           epsMapping         = new EPSMapping();

            epsMapping.versionID                = 1;
            epsMapping.pdlFlag                  = false;
            epsMapping.paramID                  = 200;
            epsMapping.worldPayFieldName        = "PrimaryPhoneNbr";
            epsMapping.worldPayTableName        = "tbTranSurcharge";
            epsMapping.worldPayJoinFields       = null;
            epsMapping.worldPayCondition        = null;
            epsMapping.worldPayOrderBy          = null;
            epsMapping.worldPayFieldDescription = "Master Cutoff Amount1";
            epsMapping.effectiveBeginDate       = DateTime.Now;
            epsMapping.effectiveEndDate         = DateTime.Now;
            epsMapping.viperTableName           = "Fee";
            epsMapping.viperFieldName           = "/ Fee / FeeRow / FeeAmount";
            epsMapping.viperCondition           = "Fee";
            epsMapping.charStartIndex           = 102;
            epsMapping.charLength               = 3;
            epsMapping.createdByUser            = "******";
            //.. Act
            var dinfo = await controller.Post(epsMapping);

            var actualRecord = ((Microsoft.AspNetCore.Mvc.ObjectResult)dinfo).Value;

            //..Assert
            Assert.Equal(((bool)actualRecord), true);
        }
Example #2
0
        public async Task InsertEPSMappingTest_Fail()
        {
            MockEPSMappingApiRepository bApi        = new MockEPSMappingApiRepository();
            IDistributedCache           _cache      = FakeCache();
            IOptions <Settings>         appSettings = Substitute.For <IOptions <Settings> >();
            var localizer = new MockStringLocalizer <EPSMappingController>();

            localizer[0] = new LocalizedString("EPSMappingTable_FieldNameErrorMsg", "Worldpay Table/Field name are mandatory");

            IEPSMappingApi epsMappingApi = new EPSMappingApi(appSettings, bApi);

            EPSMappingController controller = FakeController(_cache, epsMappingApi, localizer);

            //.. Act
            var dinfo = await controller.Post(new EPSMapping());

            var actualRecord = ((Microsoft.AspNetCore.Mvc.ObjectResult)dinfo);

            //..Assert
            Assert.Equal(actualRecord.StatusCode, (int)System.Net.HttpStatusCode.BadRequest);
            Assert.Equal(actualRecord.Value, "Worldpay Table/Field name are mandatory");
        }
Example #3
0
        public async Task InsertEPSMappingTest_FailOnPdfFlagTrue()
        {
            MockEPSMappingApiRepository bApi        = new MockEPSMappingApiRepository();
            IDistributedCache           _cache      = FakeCache();
            IOptions <Settings>         appSettings = Substitute.For <IOptions <Settings> >();
            IEPSMappingApi epsMappingApi            = new EPSMappingApi(appSettings, bApi);
            var            localizer = new MockStringLocalizer <EPSMappingController>();

            localizer[0] = new LocalizedString("EPSMappingParamNameErrorMsg", "ParamName is mandatory");

            EPSMappingController controller = FakeController(_cache, epsMappingApi, localizer);
            EPSMapping           epsMapping = new EPSMapping();

            epsMapping.versionID                = 1;
            epsMapping.pdlFlag                  = true;
            epsMapping.paramID                  = 200;
            epsMapping.worldPayFieldName        = null;
            epsMapping.worldPayTableName        = null;
            epsMapping.worldPayJoinFields       = null;
            epsMapping.worldPayCondition        = null;
            epsMapping.worldPayOrderBy          = null;
            epsMapping.worldPayFieldDescription = "Master Cutoff Amount1";
            epsMapping.effectiveBeginDate       = DateTime.Now;
            epsMapping.effectiveEndDate         = DateTime.Now;
            epsMapping.viperTableName           = "Fee";
            epsMapping.viperFieldName           = "/ Fee / FeeRow / FeeAmount";
            epsMapping.viperCondition           = null;
            epsMapping.charStartIndex           = 102;
            epsMapping.charLength               = 3;
            epsMapping.createdByUser            = "******";
            //.. Act
            var dinfo = await controller.Post(epsMapping);

            var actualRecord = ((Microsoft.AspNetCore.Mvc.ObjectResult)dinfo);

            //..Assert
            Assert.Equal(actualRecord.StatusCode, (int)System.Net.HttpStatusCode.BadRequest);
            Assert.Equal(actualRecord.Value, "ParamName is mandatory");
        }