public void MockmobileDeviceLoginTest() { //define all mocked objects as final var mockController = GetMockController<mobileDeviceLoginRequest, mobileDeviceLoginResponse>(); var mockRequest = new mobileDeviceLoginRequest { merchantAuthentication = new merchantAuthenticationType {name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey}, }; var transRetailInfoType = new transRetailInfoType { deviceType = "android", marketType = "marketplace", }; var mockResponse = new mobileDeviceLoginResponse { refId = "1234", sessionToken = "sessiontoken", merchantAccount = transRetailInfoType, }; var errorResponse = new ANetApiResponse(); var results = new List<String>(); const messageTypeEnum messageTypeOk = messageTypeEnum.Ok; SetMockControllerExpectations<mobileDeviceLoginRequest, mobileDeviceLoginResponse, mobileDeviceLoginController>( mockController.MockObject, mockRequest, mockResponse, errorResponse, results, messageTypeOk); mockController.MockObject.Execute(AuthorizeNet.Environment.CUSTOM); //mockController.MockObject.Execute(); // or var controllerResponse = mockController.MockObject.ExecuteWithApiResponse(AuthorizeNet.Environment.CUSTOM); var controllerResponse = mockController.MockObject.GetApiResponse(); Assert.IsNotNull(controllerResponse); Assert.IsNotNull(controllerResponse.merchantAccount); LogHelper.info(Logger, "mobileDeviceLogin: Details:{0}", controllerResponse.merchantAccount); }
public static void mobileDeviceLoginResponse(mobileDeviceLoginResponse argument) { if (null != argument) { merchantContactType(argument.merchantContact); if (null != argument.userPermissions) { foreach (var value in argument.userPermissions) { permissionType(value); } } transRetailInfoType(argument.merchantAccount); } }