Exemplo n.º 1
0
        /// <summary>
        /// Send data to New Relic rest API
        /// </summary>
        /// <param name="apiCommand"></param>
        /// <returns></returns>
        private HttpResponseMessage Run(IApiCommand apiCommand)
        {
            switch (apiCommand.Method.Method)
            {
            case "GET":
                return(newRelicConnector.GetData(apiCommand.GetQuery()));

            case "POST":
                return(newRelicConnector.PostData(apiCommand.GetQuery(), apiCommand.GetContent()));
            }

            throw new NotSupportedException(String.Format("HTTM method '{0}' is not supported", apiCommand.Method.Method));
        }
 protected void CheckCommandMethod(IApiCommand command)
 {
     Assert.AreEqual("GET", command.Method.Method, String.Format("Wrong method '{0}'", command.Method));
 }