public async Task PATCHDepartmentId() { var client = new RestClient("https://localhost:8088/api/v1/"); var request = new RestRequest("orgstructure/{orgstructureid}", Method.PATCH); request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Token " + token); POSTDepartment(); request.AddUrlSegment("orgstructureid", departmentId); request.AddJsonBody(new { depnum = BaseData.Departmanet_Num2, name = BaseData.Departmanet_Name2, parent = orgstructureId }); request.RequestFormat = DataFormat.Json; var response = await BaseMethods.GetResponse(client, request); var Orgstructure = JsonConvert.DeserializeObject <Orgstructure>(response.Content); Assert.That(Orgstructure.name, Is.EqualTo(BaseData.Departmanet_Name2), "orgstructure name is nor correct"); string actualtext = GetObject.GetDepartment(BaseData.Departmanet_Name2); Assert.AreEqual(BaseData.Departmanet_Name2, actualtext, "В БД studio название name of orgstructure имеет некорректное название"); }
public async Task POSTCleanerOrgstructure() { var client = new RestClient("https://localhost:8088/api/v1/"); var request = new RestRequest("cleaner/orgstructure/", Method.POST); request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Token " + token); request.AddJsonBody(new { start_id = BaseData.Company_Start_Id, finish_id = BaseData.Company_Finish_Id, }); request.RequestFormat = DataFormat.Json; var response = await BaseMethods.GetResponse(client, request); var Orgstructure = JsonConvert.DeserializeObject <Orgstructure>(response.Content); Assert.IsNull(Orgstructure, "orgstructure name is nor correct"); string actualtext = GetObject.GetDeletedCompany(BaseData.Company_Name); Assert.IsEmpty(actualtext, "В БД studio название name of orgstructure имеет некорректное название"); }
public async Task POSTJobForDelete2() { var client = new RestClient("https://localhost:8088/api/v1/"); var request = new RestRequest("job/", Method.POST); request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Token " + token); request.AddJsonBody(new { name = BaseData.Position3, code = BaseData.Position3_Code, num = BaseData.Position3_Num }); request.RequestFormat = DataFormat.Json; var response = await BaseMethods.GetResponse(client, request); var Job = JsonConvert.DeserializeObject <Job>(response.Content); jobDeletedId2 = Job.id; Assert.That(Job.name, Is.EqualTo(BaseData.Position3), "job name is nor correct"); string actualtext = GetObject.GetPosition(BaseData.Position3); Assert.AreEqual(BaseData.Position3, actualtext, "В БД studio название name of orgstructure имеет некорректное название"); }
public async Task PATCHEmployeeId() { var client = new RestClient("https://localhost:8088/api/v1/"); var request = new RestRequest("employee/{employeeid}", Method.PATCH); request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Token " + token); POSTEmployee(); request.AddUrlSegment("employeeid", employeeId); request.AddJsonBody(new { first_name = BaseData.Employee_First_Name3, last_name = BaseData.Employee_Last_Name3, parent = orgstructureId, middle_name = BaseData.Employee_Middle_Name3, workernum = BaseData.Employee_Work_Num3, photo = BaseData.Employee_Photo_Kalkin, job = jobId }); request.RequestFormat = DataFormat.Json; var response = await BaseMethods.GetResponse(client, request); var Employee = JsonConvert.DeserializeObject <Employee>(response.Content); Assert.That(Employee.last_name, Is.EqualTo(BaseData.Employee_Last_Name3), "orgstructure name is nor correct"); //правильно ли диссериализовалось string actualtext = GetObject.GetEmployee(BaseData.Employee_Full_Name3); Assert.AreEqual(BaseData.Employee_Full_Name3, actualtext, "В БД studio название name of orgstructure имеет некорректное название"); }
public async Task POSTOrgstructureForDelete() { var client = new RestClient("https://localhost:8088/api/v1/"); var request = new RestRequest("orgstructure/", Method.POST); request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Token " + token); request.AddJsonBody(new { name = BaseData.Company_Name4, depnum = BaseData.Company_Depnum4 }); request.RequestFormat = DataFormat.Json; var response = await BaseMethods.GetResponse(client, request); var orgstructure = JsonConvert.DeserializeObject <Orgstructure>(response.Content); orgstructureDeleteId = orgstructure.id; Assert.That(orgstructure.name, Is.EqualTo(BaseData.Company_Name4), "orgstructure name is nor correct"); string actualtext = GetObject.GetCompany(BaseData.Company_Name4); Assert.AreEqual(BaseData.Company_Name4, actualtext, "В БД studio название name of orgstructure имеет некорректное название"); }
public async Task POSTEmployeeForDelete() { var client = new RestClient("https://localhost:8088/api/v1/"); var request = new RestRequest("employee/", Method.POST); request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Token " + token); POSTOrgstructure(); POSTJobForDelete(); request.AddJsonBody(new { workernum = BaseData.Employee_Work_Num4, parent = orgstructureId, job = jobDeletedId, first_name = BaseData.Employee_First_Name4, last_name = BaseData.Employee_Last_Name4, middle_name = BaseData.Employee_Middle_Name4, photo = BaseData.Employee_Photo_Sogdian }); request.RequestFormat = DataFormat.Json; var response = await BaseMethods.GetResponse(client, request); var employee = JsonConvert.DeserializeObject <Employee>(response.Content); employeeDeleteid = employee.id; Assert.That(employee.last_name, Is.EqualTo(BaseData.Employee_Last_Name4), "employee name is nor correct"); string actualtext = GetObject.GetEmployee(BaseData.Employee_Full_Name4); Assert.AreEqual(BaseData.Employee_Full_Name4, actualtext, "В БД studio название name of orgstructure имеет некорректное название"); }
public async Task GETJob() { var client = new RestClient("https://localhost:8088/api/v1/"); var request = new RestRequest("job/", Method.GET); request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Token " + token); POSTJob(); var response = await BaseMethods.GetResponse(client, request); var rootObject = JsonConvert.DeserializeObject <RootObject <Job> >(response.Content); string actualtext = GetObject.GetPosition(jobName); Assert.AreEqual(jobName, actualtext, "В БД studio название name of orgstructure имеет некорректное название"); }
public async Task GETEmployeeId() { var client = new RestClient("https://localhost:8088/api/v1/"); var request = new RestRequest("employee/{employeeid}", Method.GET); request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Token " + token); POSTEmployee(); request.AddUrlSegment("employeeid", employeeId); var response = await BaseMethods.GetResponse(client, request); var Employee = JsonConvert.DeserializeObject <Employee>(response.Content); Assert.That(Employee.last_name, Is.EqualTo(BaseData.Employee_Last_Name1), "employee name is nor correct"); string actualtext = GetObject.GetEmployee(BaseData.Employee_Full_Name1); Assert.AreEqual(BaseData.Employee_Full_Name1, actualtext, "В БД studio название name of orgstructure имеет некорректное название"); }
public async Task DELETEDepartmentId() { var client = new RestClient("https://localhost:8088/api/v1/"); var request = new RestRequest("orgstructure/{orgstructureid}", Method.DELETE); request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Token " + token); POSTDepartmentForDelete(); request.AddUrlSegment("orgstructureid", departmentDeleteId); var response = await BaseMethods.GetResponse(client, request); var Orgstructure = JsonConvert.DeserializeObject <Orgstructure>(response.Content); Assert.IsNull(Orgstructure, "orgstructure name is nor correct"); string actualtext = GetObject.GetDeletedCompany(BaseData.Company_Name3); Assert.IsEmpty(actualtext, "В БД studio название name of orgstructure имеет некорректное название"); }
public async Task GETUserId() { var client = new RestClient("https://localhost:8088/api/v1/"); var request = new RestRequest("users/{usersid}", Method.GET); request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Token " + token); GETUser(); request.AddUrlSegment("usersid", userId); var response = await BaseMethods.GetResponse(client, request); var User = JsonConvert.DeserializeObject <User>(response.Content); Assert.That(User.login, Is.EqualTo(BaseData.UserRoot), "job name is nor correct"); string actualtext = GetObject.GetUserName(BaseData.UserRoot); Assert.AreEqual(BaseData.UserRoot, actualtext, "В БД studio название name of orgstructure имеет некорректное название"); }
public async Task GETJobId() { var client = new RestClient("https://localhost:8088/api/v1/"); var request = new RestRequest("job/{jobid}", Method.GET); request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Token " + token); POSTJob(); request.AddUrlSegment("jobid", jobId); var response = await BaseMethods.GetResponse(client, request); var Job = JsonConvert.DeserializeObject <Job>(response.Content); Assert.That(Job.name, Is.EqualTo(BaseData.Position1), "job name is nor correct"); string actualtext = GetObject.GetPosition(BaseData.Position1); Assert.AreEqual(BaseData.Position1, actualtext, "В БД studio название name of orgstructure имеет некорректное название"); }
public async Task POSTAuthLogin() { var client = new RestClient("https://localhost:8088/api/v1/"); client.Authenticator = new HttpBasicAuthenticator("root", "0"); var request = new RestRequest("auth/login", Method.POST); request.AddHeader("Accept", "application/json"); request.RequestFormat = DataFormat.Json; var response = await BaseMethods.GetResponse(client, request); var Login = JsonConvert.DeserializeObject <Login>(response.Content); token = Login.token; string actualtext = GetObject.GetUserId(BaseData.UserRootId); Assert.AreEqual(BaseData.UserRootId, actualtext, "В БД studio название name of orgstructure имеет некорректное название"); }
public async Task GETOrgstructureId() { var client = new RestClient("https://localhost:8088/api/v1/"); var request = new RestRequest("orgstructure/{orgstructureid}", Method.GET); request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Token " + token); POSTOrgstructure(); request.AddUrlSegment("orgstructureid", orgstructureId); var response = await BaseMethods.GetResponse(client, request); var orgstructure = JsonConvert.DeserializeObject <Orgstructure>(response.Content); Assert.That(orgstructure.name, Is.EqualTo(BaseData.Company_Name), "orgstructure name is nor correct"); string actualtext = GetObject.GetCompany(BaseData.Company_Name); Assert.AreEqual(BaseData.Company_Name, actualtext, "В БД studio название name of orgstructure имеет некорректное название"); }
public async Task DELETEEmployeeId() { var client = new RestClient("https://localhost:8088/api/v1/"); var request = new RestRequest("employee/{employeeid}", Method.DELETE); request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Token " + token); POSTCleanerEmployee(); POSTEmployeeForDelete(); request.AddUrlSegment("employeeid", employeeDeleteid); var response = await BaseMethods.GetResponse(client, request); var Employee = JsonConvert.DeserializeObject <Employee>(response.Content); Assert.IsNull(Employee, "Employee is not null"); string actualtext = GetObject.GetDeletedEmployee(BaseData.Employee_Full_Name4); Assert.IsEmpty(actualtext, "В БД studio название name of orgstructure имеет некорректное название"); }
public async Task GETReport() { var client = new RestClient("https://localhost:8088/api/v1/"); var request = new RestRequest("report/", Method.GET); request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Token " + token); var response = await BaseMethods.GetResponse(client, request); var rootObject = JsonConvert.DeserializeObject <RootObject <Report> >(response.Content); var name = rootObject.results[0].name; reportid = rootObject.results[0].id; reportArr = rootObject.results; Assert.That(name, Is.EqualTo(BaseData.Report_Name), "report name is nor correct"); string actualtext = GetObject.GetReport(BaseData.Report_Name); Assert.AreEqual(BaseData.Report_Name, actualtext, "В БД studio название name of orgstructure имеет некорректное название"); }
public async Task GETUserIdPermissions() { var client = new RestClient("https://localhost:8088/api/v1/"); var request = new RestRequest("users/{userid}/permissions", Method.GET); request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Token " + token); GETUser(); request.AddUrlSegment("userid", userId); request.RequestFormat = DataFormat.Json; var response = await BaseMethods.GetResponse(client, request); var UserPermissions = JsonConvert.DeserializeObject <UserPermissions[]>(response.Content); for (int i = 0; i < UserPermissions.Length; i++) { string actualtext = GetObject.GetUserName(BaseData.UserRoot); Assert.AreEqual(BaseData.UserRoot, actualtext, "В БД studio название name of orgstructure имеет некорректное название"); } }
public async Task DELETEJobId() { var client = new RestClient("https://localhost:8088/api/v1/"); var request = new RestRequest("job/{jobid}", Method.DELETE); request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Token " + token); POSTCleanerJob(); POSTJobForDelete(); request.AddUrlSegment("jobid", jobDeletedId); var response = await BaseMethods.GetResponse(client, request); var Job = JsonConvert.DeserializeObject <Job>(response.Content); Assert.IsNull(Job, "job name is nor correct"); string actualtext = GetObject.GetDeletedPosition(BaseData.Position2); Assert.IsEmpty(actualtext, "В БД studio название name of orgstructure имеет некорректное название"); }
public async Task GETReportId() { var client = new RestClient("https://localhost:8088/api/v1/"); GETReport(); foreach (dynamic report in reportArr) { var request = new RestRequest("report/{reportid}", Method.GET); request.AddUrlSegment("reportid", report.id); request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Token " + token); var response = await BaseMethods.GetResponse(client, request); var reportresult = JsonConvert.DeserializeObject <Report>(response.Content); Assert.That(reportresult.name, Is.EqualTo(report.name), "report name is nor correct"); string actualtext = GetObject.GetReport(report.name); Assert.AreEqual(report.name, actualtext, "В БД studio название name of orgstructure имеет некорректное название"); } }