public async Task GetAllValidApplications()
        {
            var client   = GetClient();
            var request  = RestSharpApiClientHelper.BuildBoschBlueRequest(Method.GET, "api/applications/");
            var response = await client.Execute(request);

            Assert.NotNull(response);
            _logger.LogDebug("HTTP GET of Applications returned status code: " + response.StatusCode);
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            Assert.NotNull(response.Content);
            var jsonContent = response.Content;

            _logger.LogDebug("HTTP GET of Applications returned contents: " + jsonContent);
            Assert.False(string.IsNullOrWhiteSpace(jsonContent));
            var applications = JsonConvert.DeserializeObject <ApplicationModel[]>(jsonContent);

            Assert.NotNull(applications);
            _logger.LogDebug("HTTP GET of applications returned a count of N tools: " + applications.Length);
            Assert.True(applications.Length > 0);
            Assert.All(applications, t => Assert.False(string.IsNullOrWhiteSpace(t.Name)));
            Assert.All(applications, t => Assert.False(t.ApplicationId <= 0));

            _host.Dispose();
            client.Dispose();
        }
        public async void CreatePostAndVerifyCreated()
        {
            var client      = GetClient();
            var request     = RestSharpApiClientHelper.BuildBoschBlueRequest(Method.POST, "api/accessories/");
            var anAccessory = new AccessoryModel {
                Name = "A test accessory"
            };

            request.AddJsonBody(anAccessory);
            var response = await client.Execute(request);

            Assert.True(response.StatusCode == HttpStatusCode.Created);
            Assert.NotNull(response.Content);
            _host.Dispose();
        }
        public async void CreateUpdateAndVerify()
        {
            var client = GetClient();

            var    postRequest  = RestSharpApiClientHelper.BuildBoschBlueRequest(Method.POST, "api/accessories/");
            string modelNumber  = "ACC" + RandomNumberHelper.NextInteger();
            var    theAccessory = new AccessoryModel {
                Name = "A Power Accessory", ModelNumber = modelNumber, TenantDomain = BoschTenants.BoschBlueDomain
            };

            postRequest.AddJsonBody(theAccessory);
            var postResponse = await client.Execute(postRequest);

            Assert.NotNull(postResponse);
            Assert.NotNull(postResponse.Content);
            Assert.True(postResponse.StatusCode == HttpStatusCode.Created);

            _logger.LogDebug($"Created test accessory for model id: {modelNumber}");

            var accessoryModelRequest =
                RestSharpApiClientHelper.BuildBoschBlueRequest(Method.GET, $"api/accessories/{modelNumber}");

            accessoryModelRequest.AddParameter("QueryBy", "ModelNumber", ParameterType.HttpHeader);
            var accessoryModelResponse = await client.Execute <AccessoryModel>(accessoryModelRequest);

            Assert.True(accessoryModelResponse.IsSuccess);

            _logger.LogDebug($"Retrieved test accessory with an id of: {accessoryModelResponse.Data.AccessoryId}");

            var updateRequest = RestSharpApiClientHelper.BuildBoschBlueRequest(Method.PUT,
                                                                               $"api/accessories/{accessoryModelResponse.Data.AccessoryId}");
            var theUpdatedAccessory = accessoryModelResponse.Data;

            theUpdatedAccessory.Name = "A Power Accessory (UPDATED)";
            updateRequest.AddJsonBody(theUpdatedAccessory);
            var updateResponse = await client.Execute(updateRequest);

            Assert.NotNull(updateResponse);
            Assert.NotNull(updateResponse.Content);
            Assert.True(updateResponse.StatusCode == HttpStatusCode.OK);

            _logger.LogDebug($"Updated test accessory with an id of: {theUpdatedAccessory.AccessoryId}");

            _host.Dispose();
        }
        public async void GetAccessoryByModelNumberAndThenByAccessoryId()
        {
            const string expectedAccessoryName = "85613M 1/4 In. x 1 In. Carbide Tipped 2-Flute Straight Bit";

            var client = GetClient();
            var accessoryModelRequest  = RestSharpApiClientHelper.BuildBoschBlueRequest(Method.GET, "api/accessories/85613M");
            var accessoryModelResponse = await client.Execute <AccessoryModel>(accessoryModelRequest);

            Assert.True(accessoryModelResponse.IsSuccess);
            _logger.LogDebug(accessoryModelResponse.ToString());
            Assert.Equal(expectedAccessoryName, accessoryModelResponse.Data.Name);

            var accessoryIdRequest = RestSharpApiClientHelper.BuildBoschBlueRequest(Method.GET,
                                                                                    $"api/accessories/{accessoryModelResponse.Data.AccessoryId}");

            accessoryIdRequest.AddParameter("QueryBy", "DatabaseId", ParameterType.HttpHeader);
            var accessoryIdResponse = await client.Execute <ToolModel>(accessoryIdRequest);

            Assert.True(accessoryIdResponse.IsSuccess);
            _logger.LogDebug(accessoryIdResponse.ToString());
            Assert.Equal(expectedAccessoryName, accessoryIdResponse.Data.Name);
        }
        public async void GetApplicationByNameAndThenByApplicationId()
        {
            const string expectedApplicationName = "Medium Torque Drive & Fasten";

            var client = GetClient();
            var applicationModelRequest  = RestSharpApiClientHelper.BuildBoschBlueRequest(Method.GET, "api/applications/Medium Torque Drive & Fasten");
            var applicationModelResponse = await client.Execute <ApplicationModel>(applicationModelRequest);

            Assert.True(applicationModelResponse.IsSuccess);
            _logger.LogDebug(applicationModelResponse.ToString());
            Assert.Equal(expectedApplicationName, applicationModelResponse.Data.Name);

            var applicationIdRequest = RestSharpApiClientHelper.BuildBoschBlueRequest(Method.GET,
                                                                                      $"api/applications/{applicationModelResponse.Data.ApplicationId}");

            applicationIdRequest.AddParameter("QueryBy", "DatabaseId", ParameterType.HttpHeader);
            var applicationIdResponse = await client.Execute <ToolModel>(applicationIdRequest);

            Assert.True(applicationIdResponse.IsSuccess);
            _logger.LogDebug(applicationIdResponse.ToString());
            Assert.Equal(expectedApplicationName, applicationIdResponse.Data.Name);

            // TODO; assert tag name on Drill & Drive Job with Chip Board Material
        }