Пример #1
0
        public async Task PostRole()
        {
            var postObj = new
            {
                id          = 0,
                version     = 0,
                authority   = "string",
                description = "string",
                labId       = 0,
                roleType    = "string",
                createdBy   = 0
            };

            resource = apiUrl;

            RestRequest request = baseClient.GetRequest(resource, Method.POST);

            request.AddJsonBody(postObj);

            var result = await client.ExecuteAsync <Role>(request);

            Assert.NotNull(result);
            Assert.Matches(result.Response.StatusCode.ToString(), HttpStatusCode.OK.ToString());
            Assert.NotNull(result.Data);

            Assert.True(result.Data.Id > 0);

            id = result.Data.Id;
        }
Пример #2
0
        public async Task LoginTest()
        {
            var request = new RestRequest(tokenUrl, Method.POST);

            request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
            request.AddParameter("username", "will.smith");
            request.AddParameter("password", "abc@12345");
            request.AddParameter("ipAddress", "192.168.1.1");

            var result = await client.ExecuteAsync <dynamic>(request);

            Assert.NotNull(result.Data);
            Assert.NotEmpty((result.Data as dynamic).access_token.Value);
        }
        public async Task UserAuthenticationWithValidationError()
        {
            resource = apiUrl + "/10/10.10.1.6/[email protected]/1245636";

            RestRequest request = baseClient.GetRequest(resource, Method.POST);

            var result = await client.ExecuteAsync <SerializableEntityValidationCodeResult>(request);

            Assert.NotNull(result);
            Assert.NotNull(result.Data);
            Assert.NotNull(result.Data.ValidationErrors);
            Assert.Contains(result.Data.ValidationErrors, (e) =>
            {
                return(e.ErrorCode == 1017);
            });
        }
        public async Task PostWorkOrder()
        {
            var postObj = new
            {
                id                    = 0,
                clientId              = 43,
                assignedUserRoleId    = 1,
                assignedUserId        = 1,
                batchName             = "string",
                scanDate              = "2017 - 03 - 10T07:36:25.146Z",
                pageNo                = 0,
                referenceNo           = "string",
                mrNo                  = "string",
                patientName           = "Vikas",
                dosDate               = "2017-03-10T07:36:25.146Z",
                workOrderStatusId     = 1,
                amount                = 100,
                clientDoctorName      = "string",
                referingDoctorName    = "string",
                facilityId            = 0,
                processId             = 0,
                requestTypeId         = 0,
                comments              = "string",
                createdBy             = 1,
                createdDate           = "2017-03-10T07:36:25.146Z",
                modifiedBy            = 0,
                modifiedDate          = "2017-03-10T07:36:25.146Z",
                clarificationVerified = true,
                clarificationRequired = true,
                assigneUserName       = "******",
                ticketCreatedBy       = "string",
                ticketStatusName      = "string",
                requestTypeName       = "string",
                processName           = "string",
                facilityName          = "string",
                coordinatorId         = 0
            };

            resource = apiUrl;

            RestRequest request = baseClient.GetRequest(resource, Method.POST);

            request.AddJsonBody(postObj);

            var result = await client.ExecuteAsync <WorkOrder>(request);

            Assert.NotNull(result);
            Assert.Matches(result.Response.StatusCode.ToString(), HttpStatusCode.OK.ToString());
            Assert.NotNull(result.Data);
            Assert.True(result.Data.Id > 0);
            Assert.True(postObj.clientId == result.Data.ClientId);

            id = result.Data.Id;
        }
Пример #5
0
        public async Task PostLab()
        {
            resource = apiUrl;

            RestRequest request = baseClient.GetRequest(resource, Method.POST);

            request.AddJsonBody(lab);

            var result = await client.ExecuteAsync <Lab>(request);

            Assert.NotNull(result);
            Assert.Matches(result.Response.StatusCode.ToString(), HttpStatusCode.OK.ToString());
            Assert.NotNull(result.Data);
            Assert.True(result.Data.LabName == lab.labName);
            Assert.True(result.Data.Id > 0);

            id = result.Data.Id;
        }
        public async Task PostWorkOrderClarification()
        {
            var postObj = new
            {
                id          = 0,
                workOrderId = 30,
                clarificationQuestionComment  = "string",
                clarificationQuestionBy       = 0,
                QuestionAssignToUserId        = 0,
                clarificationAnswerComment    = "string",
                clarificationAnswerBy         = 0,
                clarificationAnswerDate       = "2017-03-10T07:36:25.150Z",
                clarificationQuestionDate     = "2017-03-10T07:36:25.150Z",
                clarificationVerifiedComment  = "string",
                clarificationVerifiedDate     = "2017-03-10T07:36:25.150Z",
                clarificationRequired         = true,
                clarificationVerified         = true,
                clarificationVerifiedBy       = 0,
                clarificationQuestionUserName = "******",
                clarificationAnswerUserName   = "******",
                clarificationVerifyUserName   = "******"
            };

            resource = apiUrl;

            RestRequest request = baseClient.GetRequest(resource, Method.POST);

            request.AddJsonBody(postObj);

            var result = await client.ExecuteAsync <WorkOrderClarification>(request);

            Assert.NotNull(result);
            Assert.Matches(result.Response.StatusCode.ToString(), HttpStatusCode.OK.ToString());
            Assert.NotNull(result.Data);
            Assert.True(result.Data.Id > 0);
            Assert.True(postObj.workOrderId == result.Data.WorkOrderId);

            id = result.Data.Id;
        }
Пример #7
0
        public async Task PostUser()
        {
            resource = apiUrl;

            RestRequest request = baseClient.GetRequest(resource, Method.POST);

            request.AddJsonBody(sampleUserObject);

            var result = await client.ExecuteAsync <User>(request);

            Assert.NotNull(result);
            Assert.Matches(result.Response.StatusCode.ToString(), HttpStatusCode.OK.ToString());
            Assert.NotNull(result.Data);
            Assert.True(sampleUserObject.username == result.Data.Email);
            Assert.True(result.Data.Id > 0);

            id = result.Data.Id;
        }