public async Task ItCanUpdateAContractTemplate()
        {
            var templates = await GetTemplates();

            if (!templates.Any())
            {
                Assert.Inconclusive("No contract templates exist in the system");
                return;
            }

            var template = await GetTemplate(templates.First().ContractTemplate);

            var initialRemarks = template.Remarks;

            template.Remarks = $"CHANGED{(new Random()).Next(0, 1000000)}";

            var request  = new FortnoxApiRequest(connectionSettings.AccessToken, connectionSettings.ClientSecret);
            var response = await ContractTemplateService.UpdateContractTemplateAsync(
                request,
                template
                );

            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Data);
            Assert.AreEqual(template.Remarks, response.Data.Remarks);
            Assert.AreNotEqual(initialRemarks, response.Data.Remarks);
        }
        public async Task ItCanGetContractTemplates()
        {
            var request  = new ContractTemplateListRequest(connectionSettings.AccessToken, connectionSettings.ClientSecret);
            var response = await ContractTemplateService.GetContractTemplatesAsync(request);

            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Data);
        }
        private async Task <ContractTemplate> GetTemplate(int templateNumber)
        {
            var request = new ContractTemplateListRequest(connectionSettings.AccessToken, connectionSettings.ClientSecret);

            return((await ContractTemplateService.GetContractTemplateAsync(
                        request,
                        templateNumber
                        )).Data);
        }
        public async Task ItCanCreateAContractTemplate()
        {
            Assert.Inconclusive("Skipping this test as it can add extraneous data to the system");
            var template = GenerateTemplate();

            var request  = new FortnoxApiRequest(connectionSettings.AccessToken, connectionSettings.ClientSecret);
            var response = await ContractTemplateService.CreateContractTemplateAsync(
                request,
                template
                );

            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Data);
            Assert.AreEqual(template.TemplateName, response.Data.TemplateName);
        }
        public async Task ItCanGetAContractTemplate()
        {
            var templates = await GetTemplates();

            if (!templates.Any())
            {
                Assert.Inconclusive("No contract templates exist in the system");
            }

            var request  = new ContractTemplateListRequest(connectionSettings.AccessToken, connectionSettings.ClientSecret);
            var response = await ContractTemplateService.GetContractTemplateAsync(
                request,
                templates.First().ContractTemplate
                );

            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Data);
            Assert.AreEqual(templates.First().ContractTemplate, response.Data.TemplateNumber);
        }
        private async Task <List <ContractTemplates> > GetTemplates()
        {
            var request = new ContractTemplateListRequest(connectionSettings.AccessToken, connectionSettings.ClientSecret);

            return((await ContractTemplateService.GetContractTemplatesAsync(request)).Data.ToList());
        }