/// <summary>
        /// Methode qui set un Data d'un taux d'intêrets à partir de certains paramètres
        /// </summary>
        /// <param name="NameRate"> Nom du taux voulu</param>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        public void setInterestRate(String NameRate, DateTime startDate, DateTime endDate)
        {
            Data.InterestRate nameInterest = (Data.InterestRate)Enum.Parse(typeof(Data.InterestRate), NameRate.ToUpper());

            Services s = new Services();

            Data d = s.getInterestRate(nameInterest, startDate, endDate, donnees);

            // gestion d'erreur
            donnees.SetData(GestionErreurs.interestErreur((DataInterestRate)d, donnees));
            GestionErreurs.donneesIncomplètes(donnees, startDate, endDate);
            //
        }
Example #2
0
        public void TestRequeteComplete_Interest()
        {
            Data.InterestRate taux = Data.InterestRate.EURIBOR;


            DateTime debut = new DateTime(2015, 01, 01);
            DateTime fin   = new DateTime(2015, 04, 01);


            Services   s       = new Services();
            DataRetour dretour = new DataRetour();
            Data       donnees = s.getInterestRate(taux, debut, fin, dretour);
            // Pour extraire les données en format .csv
            string text3 = "Date;1w;2w;1m;2m;3m;6m;9m;12m;\n";


            //Trace.Write("  date        1w         2w        1m         2m         3m         6m        9m     12m \n");
            for (int i = 0; i < donnees.Ds.Tables[0].Rows.Count; i++)
            {
                text3 += ((DateTime)donnees.Ds.Tables[0].Rows[i]["Date"]).ToString("yyyy/MM/dd")
                         + ";" + ((double)donnees.Ds.Tables[0].Rows[i]["1w"]).ToString()
                         + ";" + ((double)donnees.Ds.Tables[0].Rows[i]["2w"]).ToString()
                         + ";" + ((double)donnees.Ds.Tables[0].Rows[i]["1m"]).ToString()
                         + ";" + ((double)donnees.Ds.Tables[0].Rows[i]["2m"]).ToString()
                         + ";" + ((double)donnees.Ds.Tables[0].Rows[i]["3m"]).ToString()
                         + ";" + ((double)donnees.Ds.Tables[0].Rows[i]["6m"]).ToString()
                         + ";" + ((double)donnees.Ds.Tables[0].Rows[i]["9m"]).ToString()
                         + ";" + ((double)donnees.Ds.Tables[0].Rows[i]["12m"]).ToString() + "\n";
                //Trace.Write(((DateTime)d.Ds.Tables[0].Rows[i]["Date"]).ToString("yyyy/MM/dd") + "   " + (double)d.Ds.Tables[0].Rows[i]["Open"] + "   " + (double)d.Ds.Tables[0].Rows[i]["Close"] + "   " + (double)d.Ds.Tables[0].Rows[i]["Low"] + "   " + (double)d.Ds.Tables[0].Rows[i]["High"] + "   " + (double)d.Ds.Tables[0].Rows[i]["Volume"] + "\n");
            }
            // on supprime une ligne
            // attention à ne pas prendre un vendredi ou lundi
            for (int k = 0; k < 15; k++)
            {
                donnees.Ds.Tables[0].Rows.Remove(donnees.Ds.Tables[0].Rows[15]);
            }
            Data d = GestionErreurs.interestErreur((DataInterestRate)donnees, dretour);

            Assert.AreEqual <double>((double)d.Ds.Tables[0].Rows[0]["2w"], (double)donnees.Ds.Tables[0].Rows[0]["2w"]);

            /////////////////////////////// A decommenter pour avoir les donnees de test en .csv \\\\\\\\\\\\\\\\\\\\\\\\\\
            /////////////////////////////// Penser à changer le path pour ecrire dans les fichiers \\\\\\\\\\\\\\\\\\\\\\\\

            /*
             * // Pour extraire les données en format .csv
             * string text = "Date;1w;2w;1m;2m;3m;6m;9m;12m;\n";
             * string text2 = "Date;1w;2w;1m;2m;3m;6m;9m;12m;\n";
             *
             * //Trace.Write("  date        1w         2w        1m         2m         3m         6m        9m     12m \n");
             * for (int i = 0; i < d.Ds.Tables[0].Rows.Count; i++)
             * {
             *  text += ((DateTime)d.Ds.Tables[0].Rows[i]["Date"]).ToString("yyyy/MM/dd")
             + ";" + ((double)d.Ds.Tables[0].Rows[i]["1w"]).ToString()
             + ";" + ((double)d.Ds.Tables[0].Rows[i]["2w"]).ToString()
             + ";" + ((double)d.Ds.Tables[0].Rows[i]["1m"]).ToString()
             + ";" + ((double)d.Ds.Tables[0].Rows[i]["2m"]).ToString()
             + ";" + ((double)d.Ds.Tables[0].Rows[i]["3m"]).ToString()
             + ";" + ((double)d.Ds.Tables[0].Rows[i]["6m"]).ToString()
             + ";" + ((double)d.Ds.Tables[0].Rows[i]["9m"]).ToString()
             + ";" + ((double)d.Ds.Tables[0].Rows[i]["12m"]).ToString() + "\n";
             +  //Trace.Write(((DateTime)d.Ds.Tables[0].Rows[i]["Date"]).ToString("yyyy/MM/dd") + "   " + (double)d.Ds.Tables[0].Rows[i]["Open"] + "   " + (double)d.Ds.Tables[0].Rows[i]["Close"] + "   " + (double)d.Ds.Tables[0].Rows[i]["Low"] + "   " + (double)d.Ds.Tables[0].Rows[i]["High"] + "   " + (double)d.Ds.Tables[0].Rows[i]["Volume"] + "\n");
             + }
             + for (int i = 0; i < donnees.Ds.Tables[0].Rows.Count; i++)
             + {
             +  text2 += ((DateTime)donnees.Ds.Tables[0].Rows[i]["Date"]).ToString("yyyy/MM/dd")
             + ";" + ((double)donnees.Ds.Tables[0].Rows[i]["1w"]).ToString()
             + ";" + ((double)donnees.Ds.Tables[0].Rows[i]["2w"]).ToString()
             + ";" + ((double)donnees.Ds.Tables[0].Rows[i]["1m"]).ToString()
             + ";" + ((double)donnees.Ds.Tables[0].Rows[i]["2m"]).ToString()
             + ";" + ((double)donnees.Ds.Tables[0].Rows[i]["3m"]).ToString()
             + ";" + ((double)donnees.Ds.Tables[0].Rows[i]["6m"]).ToString()
             + ";" + ((double)donnees.Ds.Tables[0].Rows[i]["9m"]).ToString()
             + ";" + ((double)donnees.Ds.Tables[0].Rows[i]["12m"]).ToString() + "\n";
             +  //Trace.Write(((DateTime)d.Ds.Tables[0].Rows[i]["Date"]).ToString("yyyy/MM/dd") + "   " + (double)d.Ds.Tables[0].Rows[i]["Open"] + "   " + (double)d.Ds.Tables[0].Rows[i]["Close"] + "   " + (double)d.Ds.Tables[0].Rows[i]["Low"] + "   " + (double)d.Ds.Tables[0].Rows[i]["High"] + "   " + (double)d.Ds.Tables[0].Rows[i]["Volume"] + "\n");
             + }
             + // On écrit dans le fichier
             + System.IO.File.WriteAllText(@"C:\Users\BVE\Desktop\Projet_Spe\TestResults\SimuleValeurComplet_interest.csv", text);
             + System.IO.File.WriteAllText(@"C:\Users\BVE\Desktop\Projet_Spe\TestResults\Temoin_interest.csv", text2);
             + //System.IO.File.WriteAllText(@"C:\Users\BVE\Desktop\Projet_Spe\TestResults\Complet_interest.csv", text3);
             */
        }