Ejemplo n.º 1
0
        public static Dictionary <string, Tuple <string, string> > properitesCompare(string PropertiesPath, string Target, RestClient client)
        {
            var myprop_dictionary  = PropertiesLoad.properitesParser(PropertiesPath);
            var envprop_dictionary = getProperiesFromEnv(Target, client);
            var diff_Dictionary    = new Dictionary <string, Tuple <string, string> >();

            foreach (KeyValuePair <string, string> entry in envprop_dictionary)
            {
                //myprop_dictionary.TryGetValue((string)entry.Key, out value) &
                if (!myprop_dictionary[entry.Key].Equals(entry.Value))
                {
                    Tuple <string, string> OldAndNewValues = new Tuple <string, string>(entry.Value, myprop_dictionary[entry.Key]);
                    Console.WriteLine("#################");
                    Console.WriteLine(OldAndNewValues);
                    Console.WriteLine("#################");

                    diff_Dictionary.Add((string)entry.Key, OldAndNewValues);
                }
            }
            //printDictionary(myprop_dictionary);
            //Console.WriteLine("#################");
            //printDictionary(diff_Dictionary);

            return(diff_Dictionary);
        }
Ejemplo n.º 2
0
        public static void postProperties(string PropertiesPath, string Target, RestClient client)
        {
            var myprop_dictionary = PropertiesLoad.properitesParser(PropertiesPath);
            var jObjectBody       = PropertiesLoad.loadToJObject(myprop_dictionary);


            RestRequest postResquest = new RestRequest(Target, Method.POST);

            postResquest.RequestFormat = DataFormat.Json;
            postResquest.AddParameter("application/json", jObjectBody, ParameterType.RequestBody);
            IRestResponse postResponse = client.Execute(postResquest);

            Console.WriteLine("Status code: " + postResponse.StatusCode);
            Console.WriteLine("Status message " + postResponse.Content);
        }