コード例 #1
0
        public void Response200WithPerPage()
        {
            ApiResponse <object> response = api.GetEntities(perPage: 2);

            Assert.AreEqual(200, response.StatusCode);
            GetEntitiesResponse parsedResponse = (GetEntitiesResponse)response.Data;

            Assert.AreEqual(1, parsedResponse.Pagination.CurrentPage);
            Assert.AreEqual(2, parsedResponse.Pagination.ReturnedCount);
        }
コード例 #2
0
ファイル: EntityManager.cs プロジェクト: dadatschi/RWEDotNet
        /// <summary>
        /// Erzeugt eine neue Instanz der Klasse
        /// </summary>
        /// <param name="requestHandler">Instanz von RequestHandler</param>
        public EntityManager(IRequestHandler requestHandler)
        {
            this.requestHandler = requestHandler;
            var request = new GetEntitiesRequest()
            {
                EntityType = "Configuration"
            };

            GetEntitiesResponse response = requestHandler.RequestResponse <GetEntitiesRequest, GetEntitiesResponse>(request);

            logicalDevices = response.LogicalDevices;
            locations      = response.Locations;
            profiles       = response.Profiles;
        }
コード例 #3
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            GetEntitiesResponse response = new GetEntitiesResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("descriptions", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <EntityDescription, EntityDescriptionUnmarshaller>(EntityDescriptionUnmarshaller.Instance);
                    response.Descriptions = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }