public MileageTargetAPIResponse PostMileageTargetRequest() { mileageTargetAPIRequest = null; //CustomHeaders = new Dictionary<string, string>(); // if (string.IsNullOrEmpty(AccessToken)) GetToken(); try { string MileageTargetRequestString = GetRequestString(); //CustomHeaders.Add(CustomerUid, CustomerUID); LogResult.Report(Log, "log_ForInfo", "Request string: " + MileageTargetRequestString); LogResult.Report(Log, "log_ForInfo", "Post to URL: " + AssetServiceConfig.FuelBurnRateAPI); ResponseString = RestClientUtil.DoHttpRequest(AssetServiceConfig.FuelBurnRateAPI, HeaderSettings.PostMethod, AccessToken, HeaderSettings.JsonMediaType, MileageTargetRequestString, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType, CustomHeaders); LogResult.Report(Log, "log_ForInfo", "Response Recieved: " + ResponseString); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Got Error While Getting Data From AlertsManager Service", e); throw new Exception(e + " Got Error While Getting Data From AlertsManager Service"); } try { mileageTargetAPIResponse = JsonConvert.DeserializeObject <MileageTargetAPIResponse>(ResponseString); LogResult.Report(Log, "log_ForInfo", "Deserialized the response"); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Got Error While DeSerializing JSON Object", e); throw new Exception(e + " Got Error While DeSerializing JSON Object"); } return(mileageTargetAPIResponse); }
public void PostFuelBurntRate(bool isvalid = true) { var requestString = JsonConvert.SerializeObject(fuelRequest); try { LogResult.Report(Log, "log_ForInfo", "Create Fuel Burnt rate: Starts"); string accessToken = AssetServiceConfig.GetValidUserAccessToken(); string response; SetCustomerUIDHeader(AssetServiceConfig.CustomerUID); if (isvalid) { response = RestClientUtil.DoHttpRequest(AssetServiceConfig.FuelBurnRateAPI, HeaderSettings.PutMethod, accessToken, HeaderSettings.JsonMediaType, requestString, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType, CustomHeaders); } else { response = RestClientUtil.DoInvalidHttpRequest(AssetServiceConfig.FuelBurnRateAPI, HeaderSettings.PutMethod, accessToken, HeaderSettings.JsonMediaType, requestString, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType, CustomHeaders); } fuelResponse = JsonConvert.DeserializeObject <FuelBurntRateResponse>(response); LogResult.Report(Log, "log_ForInfo", "Create Fuel Burnt rate: Ends"); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Exception Occured while creating fuel burnt rate " + e); throw new Exception("Exception Occured while creating creating fuel burnt rate \n"); } }
public void WhenIPostValidCustomerListWebApiGetUserMultipleCustomerListRequest() { string accessToken = GetValidUserAccessToken(MultipleCustomerUserLoginId); ResponseString = RestClientUtil.DoHttpRequest(CustomerListConfig.CustomerListWebAPI, HeaderSettings.GetMethod, accessToken, HeaderSettings.JsonMediaType, null, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType); }
public void GetAssetDetails(int pageNumber = 1) { GetToken(false); if (pageNumber == 1) { CustomHeaders.Add(CustomerUid, CustomerUID.ToString()); } try { LogResult.Report(Log, "log_ForInfo", "GetAssetDetails-AssetSettings: Starts"); if (queryString == null && endPoint == null) { queryString = "?PageNumber=" + Convert.ToString(pageNumber) + "&PageSize=" + Convert.ToString(getAssetSettingsRequest.PageSize) + "&sortcolumn=" + Convert.ToString(getAssetSettingsRequest.SortColumn); endPoint = AssetServiceConfig.AssetSettingsEndPoint + queryString; } LogResult.Report(Log, "log_ForInfo", "Get URL: " + endPoint); ResponseJSON = RestClientUtil.DoHttpRequest(endPoint, HeaderSettings.GetMethod, AccessToken, HeaderSettings.JsonMediaType, null, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType, CustomHeaders); LogResult.Report(Log, "log_ForInfo", "GetAssetDetails-AssetSettings: Ends "); } catch (Exception e) { } }
public void RetrieveAssetSettings() { string requestString = string.Empty; string asset = string.Empty; var count = 1; foreach (var assetTarget in createAssetSettingsRequest.assetTargetSettings) { Convert.ToString(createAssetSettingsRequest.assetTargetSettings.Select(a => a.assetUid)); asset = "\"" + asset + "\","; count = count + 1; } requestString = "[" + asset + "]"; if (count == 1) { requestString.Trim(','); } GetToken(); LogResult.Report(Log, "log_ForInfo", "Retrieve Asset Settings: Starts"); var retrieveAssetSettingsUrl = @"https://api-stg.trimble.com/t/trimble.com/vss-dev-assetservice/1.0/assetsettings/targets/retrieve?" + Convert.ToString(createAssetSettingsRequest.assetTargetSettings.Select(a => a.startDate)) + "&" + Convert.ToString(createAssetSettingsRequest.assetTargetSettings.Select(a => a.endDate)); var RetrieveAssetResponse = RestClientUtil.DoHttpRequest(retrieveAssetSettingsUrl, HeaderSettings.PostMethod, AccessToken, HeaderSettings.JsonMediaType, requestString, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType, null); RetrieveAssetSettingsResponse = JsonConvert.DeserializeObject <RetrieveAssetSettingsResponse>(RetrieveAssetResponse); LogResult.Report(Log, "log_ForInfo", "Retrieve Asset Settings: Ends"); }
public void PostAssociateAssetDevice() { responseModel = null; //CustomHeaders = new Dictionary<string, string>(); // if (string.IsNullOrEmpty(AccessToken)) GetToken(); try { string AssociateAssetDeviceRequestString = GetAssociateAssetDeviceRequestString(); //CustomHeaders.Add(CustomerUid, CustomerUID); LogResult.Report(Log, "log_ForInfo", "Request string: " + AssociateAssetDeviceRequestString); LogResult.Report(Log, "log_ForInfo", "Post to URL: " + AssetServiceConfig.DeviceAssetAssociationEndpoint); ResponseString = RestClientUtil.DoHttpRequest(AssetServiceConfig.DeviceAssetAssociationEndpoint, HeaderSettings.PostMethod, AccessToken, HeaderSettings.JsonMediaType, AssociateAssetDeviceRequestString, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType, CustomHeaders); LogResult.Report(Log, "log_ForInfo", "Response Recieved: " + ResponseString); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Got Error While Getting Data From AlertsManager Service", e); throw new Exception(e + " Got Error While Getting Data From AlertsManager Service"); } try { //responseModel = JsonConvert.DeserializeObject<ResponseModel>(ResponseString); LogResult.Report(Log, "log_ForInfo", "Deserialized the response"); } catch (Exception e) { //LogResult.Report(Log, "log_ForError", "Got Error While DeSerializing JSON Object", e); throw new Exception(e + " Got Error While DeSerializing JSON Object"); } //return responseModel; }
public void RetrieveProductivityDetails() { string requestString = string.Empty; requestString = JsonConvert.SerializeObject(CreateProductitvityResponse); requestString = requestString.Replace("\"assetUID\":", ""); requestString = requestString.Replace("{", ""); requestString = requestString.Replace("}", ""); try { GetToken(); LogResult.Report(Log, "log_ForInfo", "Create Asset Productivity: Starts"); var ProductivityResponse = RestClientUtil.DoHttpRequest(AssetServiceConfig.RetrieveProductivityDetailsEndpoint + "?startdate=" + CreateproductivityTargetsRequest.assettargets.Select(a => a.startdate).FirstOrDefault() + "&enddate=" + CreateproductivityTargetsRequest.assettargets.Select(a => a.enddate).FirstOrDefault(), HeaderSettings.PostMethod, AccessToken, HeaderSettings.JsonMediaType, requestString, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType, null); retrieveProductivityDetails = JsonConvert.DeserializeObject <RetrieveProductivityDetails>(ProductivityResponse); LogResult.Report(Log, "log_ForInfo", "Create Asset Productivity: Ends"); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Exception Occured while creating asset settings" + CreateproductivityTargetsRequest.assettargets.Select(a => a.assetuid)); throw new Exception("Exception Occured while creating asset productivity \n"); } }
public void AssociateAssetDevice() { Guid.TryParse(AssetUID, out AssetUidGuid); associateAssetDevice = new AssociateAssetDevice { DeviceUID = defaultValidDeviceServiceCreateModel.DeviceUID, AssetUID = AssetUidGuid, ReceivedUTC = DateTime.Now, ActionUTC = DateTime.Now }; var requestString = JsonConvert.SerializeObject(associateAssetDevice); try { GetToken(true); var response = RestClientUtil.DoHttpRequest(AssetServiceConfig.DeviceAssetAssociationEndpoint, HeaderSettings.PostMethod, AccessToken, HeaderSettings.JsonMediaType, requestString, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType, null); LogResult.Report(Log, "log_ForInfo", "Device Asset Association ends-Success "); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Exception Occured while associating asset to device" + "AssetUID-" + AssetUidGuid + "DeviceUID-" + defaultValidDeviceServiceCreateModel.DeviceUID); throw new Exception("Exception Occured while associating asset to device" + "AssetUID - " + AssetUidGuid + "DeviceUID - " + defaultValidDeviceServiceCreateModel.DeviceUID); } }
public void PostAssociateAssetCustomer() { try { string AssociateAssetCustomerRequest = GetAssociateAssetCustomerRequestString(); string AssociateAssetCustomer = "https://api-stg.trimble.com/t/trimble.com/vss-dev-customerservice/1.0/AssociateCustomerAsset"; var Responsestring = RestClientUtil.DoHttpRequest(AssociateAssetCustomer, HeaderSettings.PostMethod, AccessToken, HeaderSettings.JsonMediaType, AssociateAssetCustomerRequest, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType, null); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Exception Occured while associating asset to device" + "AssetUID-" + createAssetEvent.AssetUID + "Customer-" + associateAssetCustomer.CustomerUID); throw new Exception("Exception Occured while associating asset to device" + "AssetUID-" + createAssetEvent.AssetUID + "Customer-" + associateAssetCustomer.CustomerUID); } }
public void GetAccountHierarchyByUserUID() { // AccountHierarchyByUserUIDResponseString try { LogResult.Report(Log, "log_ForInfo", "Performing Get Account Hierarchy By User UID"); AccountHierarchyByUserUIDResponseString = RestClientUtil.DoHttpRequest(CustomerServiceConfig.AccountHierarchyByUserUIDEndPoint, HeaderSettings.GetMethod, accessToken, HeaderSettings.JsonMediaType, null, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Got Error While Performing Get Account Hierarchy By User UID", e); throw new Exception(e + " Got Error While Performing Get Account Hierarchy By User UID"); } }
public string PostValidReadRequestToService(string accessToken) { try { LogResult.Report(Log, "log_ForInfo", "Reading the list of available geofences for the user accesstoken the request with Valid Values: " + accessToken); string ResponseString = RestClientUtil.DoHttpRequest(CustomerServiceConfig.CustomerServiceEndpoint + "/accounthierarchy", HeaderSettings.GetMethod, accessToken, HeaderSettings.JsonMediaType, null, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType); return(ResponseString); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Got Error While Posting Data To Geofence Service", e); throw new Exception(e + " Got Error While Posting Data To Geofence Service"); } }
private static string GetKafkaEndPointURL(string kafkatopicName) { try { string response = RestClientUtil.DoHttpRequest(DiscoveryServiceURI.ToString(), HeaderSettings.GetMethod, accessToken, HeaderSettings.JsonMediaType, null, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType); JObject jsonObj = JObject.Parse(response); var token = jsonObj.SelectToken("$.Topics[?(@.Name == '" + kafkatopicName + "')].URL"); return(token.ToString()); } catch (Exception) { } return(null); }
public void CreateDevice() { try { GetToken(true); var requestString = JsonConvert.SerializeObject(defaultValidDeviceServiceCreateModel); LogResult.Report(Log, "log_ForInfo", "Create Device: Starts" + requestString); var createDeviceRespoonse = RestClientUtil.DoHttpRequest(AssetServiceConfig.DeviceServiceEndpoint, HeaderSettings.PostMethod, AccessToken, HeaderSettings.JsonMediaType, requestString, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType, null); LogResult.Report(Log, "log_ForInfo", "Create Device: Ends "); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Exception Occured while creating Device" + defaultValidDeviceServiceCreateModel.DeviceUID); throw new Exception("Exception Occured while creating device\n" + defaultValidDeviceServiceCreateModel.DeviceUID); } }
public void DeleteAsset() { try { LogResult.Report(Log, "log_ForInfo", "Delete Asset: Starts" + CreateAsset.AssetUID.ToString()); GetToken(true); var endPoint = AssetServiceConfig.AssetServiceEndpoint + "?" + AssetServiceConfig.AssetUID + "=" + CreateAsset.AssetUID + "&ActionUTC=" + DateTime.Today; var DeleteAsset = RestClientUtil.DoHttpRequest(endPoint, HeaderSettings.DeleteMethod, AccessToken, null, HeaderSettings.JsonMediaType, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType, null); LogResult.Report(Log, "log_ForInfo", "Delete Asset: Ends" + CreateAsset.AssetUID.ToString()); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Exception Occured while deleting asset" + CreateAsset.AssetUID); throw new Exception("Exception Occured while deleting asset\n" + CreateAsset.AssetUID); } }
public void PostValidUpdateRequestToService() { string requestString = JsonConvert.SerializeObject(UpdateCustomerModel); try { string accessToken = CustomerServiceConfig.GetValidUserAccessToken(); LogResult.Report(Log, "log_ForInfo", "Posting the request with Valid Values: " + requestString); ResponseString = RestClientUtil.DoHttpRequest(CustomerServiceConfig.CustomerServiceEndpoint, HeaderSettings.PutMethod, accessToken, HeaderSettings.JsonMediaType, requestString, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Got Error While Posting Data To Customer Service", e); throw new Exception(e + " Got Error While Posting Data To Customer Service"); } }
public void CreateAssets(int no_of_Assets = 1) { try { SetDefaultValidValuesToAssets(); GetToken(true); var requestString = JsonConvert.SerializeObject(CreateAsset); LogResult.Report(Log, "log_ForInfo", "Create Asset: Starts" + requestString); var createAssetResponse = RestClientUtil.DoHttpRequest(AssetServiceConfig.AssetServiceEndpoint, HeaderSettings.PostMethod, AccessToken, HeaderSettings.JsonMediaType, requestString, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType, null); LogResult.Report(Log, "log_ForInfo", "Create Asset: Ends "); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Exception Occured while creating asset" + CreateAsset.AssetUID); throw new Exception("Exception Occured while creating asset\n" + CreateAsset.AssetUID); } }
public void GetFuelBurntRate() { try { var requestString = JsonConvert.SerializeObject(assetUIDS); LogResult.Report(Log, "log_ForInfo", "Get Fuel Burnt rate: Starts"); string accessToken = AssetServiceConfig.GetValidUserAccessToken(); var response = RestClientUtil.DoHttpRequest(AssetServiceConfig.FuelBurnRateAPI, HeaderSettings.PostMethod, accessToken, HeaderSettings.JsonMediaType, requestString, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType, CustomHeaders); getFuelResponse = JsonConvert.DeserializeObject <FuelBurntRateResponse>(response); LogResult.Report(Log, "log_ForInfo", "Get Fuel Burnt rate: Ends"); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Exception Occured while getting fuel burnt rate " + e); throw new Exception("Exception Occured while getting fuel burnt rate \n"); } }
/// <summary> /// Creates productivity details for an asset/assets /// </summary> public void ValidPutRequest() { var requestString = JsonConvert.SerializeObject(CreateproductivityTargetsRequest); try { GetToken(); LogResult.Report(Log, "log_ForInfo", "Create Asset Productivity: Starts"); var ProductivityResponse = RestClientUtil.DoHttpRequest(AssetServiceConfig.CreateProductivityDetailsEndpoint, HeaderSettings.PutMethod, AccessToken, HeaderSettings.JsonMediaType, requestString, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType, null); CreateProductitvityResponse = JsonConvert.DeserializeObject <ProductivityTargetsResponseModel>(ProductivityResponse); LogResult.Report(Log, "log_ForInfo", "Create Asset Productivity: Ends"); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Exception Occured while creating asset settings" + CreateproductivityTargetsRequest.assettargets.Select(a => a.assetuid)); throw new Exception("Exception Occured while creating asset productivity \n"); } }
public void PostValidDeleteRequestToService(Guid customerUid, DateTime actionUtc) { string actionUtcString = actionUtc.ToString("yyyy-MM-ddThh:mm:ss"); string customerUID = customerUid.ToString(); try { string accessToken = CustomerServiceConfig.GetValidUserAccessToken(); LogResult.Report(Log, "log_ForInfo", "Posting the request with Valid Values: " + customerUID); ResponseString = RestClientUtil.DoHttpRequest(string.Format("{0}?CustomerUID={1}&ActionUTC={2}", CustomerServiceConfig.CustomerServiceEndpoint, customerUID, actionUtcString), HeaderSettings.DeleteMethod, accessToken, HeaderSettings.JsonMediaType, null, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Got Error While Posting Data To Customer Service", e); throw new Exception(e + " Got Error While Posting Data To Customer Service"); } }
public void CreateValidAssetSettings() { var requestString = JsonConvert.SerializeObject(createAssetSettingsRequest); try { GetToken(); LogResult.Report(Log, "log_ForInfo", "Create Asset Settings: Starts"); var createAssetResponse = RestClientUtil.DoHttpRequest("https://api-stg.trimble.com/t/trimble.com/vss-dev-assetservice/1.0/assetsettings/targets/Save", HeaderSettings.PutMethod, AccessToken, HeaderSettings.JsonMediaType, requestString, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType, null); createAssetSettingsResponse = JsonConvert.DeserializeObject <CreateAssetSettingsResponse>(createAssetResponse); LogResult.Report(Log, "log_ForInfo", "Create Asset Settings: Ends"); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Exception Occured while creating asset settings" + createAssetSettingsRequest.assetTargetSettings.Select(a => a.assetUid)); throw new Exception("Exception Occured while creating asset settings \n"); } }
public void GetDeviceTypeDetails() { try { LogResult.Report(Log, "log_ForInfo", "GetDeviceTypeDetails: Starts for Customer" + CustomerUID); if (CustomHeaders == null) { CustomHeaders.Add(CustomerUid, CustomerUID.ToString()); } GetToken(false); var ResponseJSON = RestClientUtil.DoHttpRequest(AssetServiceConfig.GetDeviceType, HeaderSettings.GetMethod, AccessToken, HeaderSettings.JsonMediaType, null, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType, CustomHeaders); deviceTypeResponse = JsonConvert.DeserializeObject <DeviceTypeResponse>(ResponseJSON); LogResult.Report(Log, "log_ForInfo", "GetDeviceTypeDetails: Ends for Customer" + CustomerUID); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Exception Occured while getting device type details" + "CustomerUID-" + CustomerUID); throw new Exception("Exception Occured while getting device type details" + "CustomerUID - " + CustomerUID + "DeviceUID - "); } }
public void AssociateAssetCustomer() { associateAssetCustomer = new AssociateAssetCustomer { CustomerUID = CustomerUID, AssetUID = CreateAsset.AssetUID, RelationType = "Customer", ActionUTC = DateTime.Now, ReceivedUTC = DateTime.Now }; var requestString = JsonConvert.SerializeObject(associateAssetCustomer); try { GetToken(true); var response = RestClientUtil.DoHttpRequest("https://api-stg.trimble.com/t/trimble.com/vss-dev-customerservice/1.0/AssociateCustomerAsset", HeaderSettings.PostMethod, AccessToken, HeaderSettings.JsonMediaType, requestString, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType, null); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Exception Occured while associating asset to device" + "AssetUID-" + CreateAsset.AssetUID + "Customer-" + associateAssetCustomer.CustomerUID); throw new Exception("Exception Occured while associating asset to device" + "AssetUID-" + CreateAsset.AssetUID + "Customer-" + associateAssetCustomer.CustomerUID); } }
public void CanDoExportSuccess() { Msg.Title("Scheduler web test 1", "Schedule export job happy path"); //Schedule the export job... var filterUid = "81422acc-9b0c-401c-9987-0aedbf153f1d"; var jobId = GetScheduledJobId(filterUid, SUCCESS_JOB_ID); //Get the job status... var statusResult = WaitForExpectedStatus(jobId, "SUCCEEDED"); Assert.IsTrue(!string.IsNullOrEmpty(statusResult.DownloadLink), "Should get a download link on success"); //Download the zip file... var restClient = new RestClientUtil(); var response = restClient.DoHttpRequest(statusResult.DownloadLink, "GET", null, HttpStatusCode.OK, string.Empty, CustomerUid.ToString()); var actualSorted = Common.SortCsvFileIntoString(response); var expectedBytes = JsonConvert.DeserializeObject <byte[]>( "\"UEsDBBQAAAgIAEsQe0tesHMI2AEAANUIAAAIAAAAVGVzdC5jc3bNlM1um0AQgO+V+g4op1aabPeH5Sc3Sn4q1SDLRpZ6stawjVcB1gXiqn21HvpIfYUu1CZSAlVRKsVcZhdmhk/fDvz68TNRhYRQ5nm8Lrp4ZeJVLveiUbo067mo6/i+2MgKZqJuFiJTetaU6Te4lLW6LWNhGkQi3apSwnInZba+K95tu+Sb+TLSmQQTgzRNdG76JaK6bXuG+r5sYCVylc11DTP1uelqwmjV5bSx3UeX827fxg7gcP+6kl/WH75366DYrYs/rZOtSu9KWdfmVQeqGykqWKmNXDaikV1BIk1F+voVxYSex3p/jrmF/QtuXzAHMQ8DoZgjwjBQj1LECQbue4i75glgiIK5hQmchUFihUvuvD8DijDMdNpZsxbJRwi1qGppvcGIYq94Cww+ydpUA8cmlTAX+UC6tbnaJAwLuZemBmLdWMFul6tUbHIJg5juA6btPsJ0qDuGySZi2m3BMzD5gE2PH2xye9ymPc0mRu5jzGtdfRVV9k+YQ4feY7Z6T+PQ+cCh95hs9NB9RKbatJ9jc2g2j5iOwRyx+fKzyRDxj7Ppj39C7jSbBNH/ZPMp5knOZo/J2QHTYadss8c8bZuee7T5l9/7y9vsMV06bpNPw/Qn2PwNUEsBAhQAFAAACAgASxB7S16wcwjYAQAA1QgAAAgAAAAAAAAAAAAgAAAAAAAAAFRlc3QuY3N2UEsFBgAAAAABAAEANgAAAP4BAAAAAA==\""); var expected = Encoding.Default.GetString(Common.Decompress(expectedBytes)); var expectedSorted = Common.SortCsvFileIntoString(expected); Assert.AreEqual(expectedSorted, actualSorted, "Export data does not match"); }
public void GetAssetDeviceList(string searchType = null, string pageNo = null, string pageSize = null) { createAssetEvent = AssetServiceSteps.assetServiceSupport.CreateAssetModel; string searchString = string.Empty; string requestType = string.Empty; if (searchType == "AssetSN") { searchString = createAssetEvent.SerialNumber; } else if (searchType == "AssetName") { searchString = createAssetEvent.AssetName; } else if (searchType == "DeviceSN") { searchString = CreateDeviceModel.DeviceSerialNumber; } else if (searchType == "AssetSNSorting" || searchType == "Valid") { searchString = validSearchString; } else if (searchType == "Wrong") { searchString = wrongSearchString; } else { searchString = searchType; } if (pageNo == "Valid") { pageNo = validPageNo; } else if (pageNo == "Invalid") { pageNo = invalidPageNo; requestType = "Invalid"; } else if (pageNo == "Wrong") { pageNo = wrongPageNo; } else if (pageNo == "0" || pageNo == "-1") { requestType = "Invalid"; } if (pageSize == "Valid") { pageSize = validPageSize; } else if (pageSize == "Invalid") { pageSize = invalidPageSize; requestType = "Invalid"; } else if (pageSize == "Wrong") { pageSize = wrongPageSize; } else if (pageSize == "0" || pageSize == "-1") { requestType = "Invalid"; } string parameters = string.Empty; if (searchString != null && pageNo == null && pageSize == null) { parameters = "?" + AssetServiceConfig.SearchString + "=" + searchString; } else if (searchString == null && pageNo != null && pageSize == null) { parameters = "?" + AssetServiceConfig.PageNo + "=" + pageNo; } else if (searchString == null && pageNo == null && pageSize != null) { parameters = "?" + AssetServiceConfig.PageSize + "=" + pageSize; } else if (searchString != null && pageNo != null && pageSize == null) { parameters = "?" + AssetServiceConfig.SearchString + "=" + searchString + "&" + AssetServiceConfig.PageNo + "=" + pageNo; } else if (searchString != null && pageNo == null && pageSize != null) { parameters = "?" + AssetServiceConfig.SearchString + "=" + searchString + "&" + AssetServiceConfig.PageSize + "=" + pageSize; } else if (searchString == null && pageNo != null && pageSize != null) { parameters = "?" + AssetServiceConfig.PageNo + "=" + pageNo + "&" + AssetServiceConfig.PageSize + "=" + pageSize; } else if (searchString != null && pageNo != null && pageSize != null) { parameters = "?" + AssetServiceConfig.SearchString + "=" + searchString + "&" + AssetServiceConfig.PageNo + "=" + pageNo + "&" + AssetServiceConfig.PageSize + "=" + pageSize; } else if (searchString == null && pageNo == null && pageSize == null) { parameters = ""; } try { string accessToken = AssetServiceConfig.GetValidUserAccessToken(); LogResult.Report(Log, "log_ForInfo", "Getting the AssetDetail Values:"); if (requestType == "Invalid") { ResponseString = RestClientUtil.DoInvalidHttpRequest(AssetServiceConfig.AssetSearchEndpoint + parameters, HeaderSettings.GetMethod, accessToken, HeaderSettings.JsonMediaType, null, HttpStatusCode.BadRequest, HeaderSettings.BearerType, HeaderSettings.JsonMediaType); } else { ResponseString = RestClientUtil.DoHttpRequest(AssetServiceConfig.AssetSearchEndpoint + parameters, HeaderSettings.GetMethod, accessToken, HeaderSettings.JsonMediaType, null, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType); } } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Got Error While Getting Data from Asset Device Search Service", e); throw new Exception(e + " Got Error While Getting Data from Asset Device Search Service"); } }