public void AddAlumnoJsonTest(int id, string nombre, string apellido, string dni)
        {
            string     path_test = "C:/Users/Daniel Madrigal/Downloads/Fichero/FicheroTests1/bin/Debug/Registro.json";
            Guid       guid      = Guid.NewGuid();
            Alumno     al        = new Alumno(guid, id, nombre, apellido, dni);
            FormatJson ft        = new FormatJson("json");

            ft.Add(al);
            Assert.IsTrue(File.Exists(path_test));

            List <Alumno> alumnos = new List <Alumno>();
            Alumno        registrado;

            using (FileStream fl = new FileStream(path_test, FileMode.Open, FileAccess.Read))
            {
                using (StreamReader sr = new StreamReader(fl))
                {
                    string line = sr.ReadToEnd();
                    alumnos = JsonConvert.DeserializeObject <List <Alumno> >(line);
                }
                registrado      = alumnos[0];
                registrado.Guid = guid;
            }
            Assert.IsTrue(al.Equals(registrado));
            File.Delete(path_test);
        }
        public IDictionary <string, string> GetJournalData()
        {
            var journalData = new Dictionary <string, string>
            {
                { DOCUMENTATION_KEY, DocumentFormat.ToString() },
                { FORMAT_JSON_KEY, FormatJson.ToString() },
                { URL_KEY, WebUrl },
                { API_KEY, ApiKey },
            };

            return(journalData);
        }
示例#3
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = FormatJson.GetHashCode();
         hashCode = (hashCode * 397) ^ (LogFormat != null ? LogFormat.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Logger != null ? Logger.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)LoggingLevel;
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         return(hashCode);
     }
 }