public void Configuration_errors_returns_failure_and_failure_report()
        {
            DoctorReport report = fetchReport <BootstrapperThatWouldCreateErrors>("");

            report.Result.ShouldEqual(DoctorResult.ConfigurationErrors);
            report.ErrorMessages.ShouldContain("cannot be plugged into type");
        }
Example #2
0
        public object Post([FromBody] DoctorReport value)
        {
            Console.WriteLine("showReport");
            var v = ShowReport(value);

            // var boole = ShowReport(value);
            Console.WriteLine("show Doc");
            Console.WriteLine(v);
            Console.WriteLine(" v is null " + v != null);

            if (v != null)
            {
                Console.WriteLine("Yeess");
                return(new ResponseReport
                {
                    status = "Success", message = "Record SuccessFully Saved.", data = v
                });
            }
            else
            {
                return(new ResponseReport
                {
                    status = "Field", message = "Existing Record.", data = null
                });
            }
        }
        public void Bootstrapper_throws_error()
        {
            DoctorReport report = fetchReport <BootstrapperThatThrowsError>("");

            report.Result.ShouldEqual(DoctorResult.BootstrapperFailure);
            report.ErrorMessages.ShouldContain(BootstrapperThatThrowsError.ERROR);
        }
Example #4
0
        public async Task <RedirectResult> AddReport(int IdAppointment, [Bind(Exclude = "Date")] DoctorReport report, List <string> symptoms, List <string> complaints, List <string> complaints2, List <string> analyses)
        {
            report.Complaints  = Symptom.GetSymptomsString(complaints);
            report.Complaints2 = Symptom.GetSymptomsString(complaints2);
            report.Analyses    = Symptom.GetSymptomsString(analyses);
            report.IdSymptoms  = Symptom.GetSymptomsString(symptoms);
            report.Date        = DateTime.Now;
            using (var transaction = db.Database.BeginTransaction())
            {
                try
                {
                    Appointment appointment = await db.Appointments.FindAsync(IdAppointment);

                    db.Appointments.Remove(appointment);
                    db.DoctorReports.Add(report);
                    await db.SaveChangesAsync();

                    transaction.Commit();
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                }
            }
            return(Redirect("/Cabinet"));
        }
        Successful_configuration_with_failed_validation_tests_returns_failure_and_whatdoihave_and_validation_report()
        {
            DoctorReport report = fetchReport <BootstrapperThatFailsValidationMethod>("");

            report.Result.ShouldEqual(DoctorResult.ValidationErrors);
            report.WhatDoIHave.ShouldNotBeEmpty();
            report.ErrorMessages.ShouldContain("NotGoingToWork");
        }
Example #6
0
        public static int Main(string[] args)
        {
            if (args[0] == "?")
            {
                writeUsage();
                return(0);
            }

            if (args.Length == 0)
            {
                writeUsage();
                return(1);
            }


            var doctor = new Doctor
            {
                BinaryPath       = AppDomain.CurrentDomain.BaseDirectory,
                BootstrapperType = args[0],
                ConfigFile       = string.Empty,
                OutputFile       = string.Empty
            };


            for (int i = 1; i < args.Length; i++)
            {
                string   argument = args[i];
                string[] parts    = argument.Split('=');
                if (parts.Length != 2)
                {
                    writeUsage();
                    return(1);
                }

                parseArgument(parts, doctor);
            }

            Console.WriteLine();
            DoctorReport report = doctor.RunReport();

            if (report.Result == DoctorResult.Success)
            {
                Console.WriteLine("SUCCESS!");
            }
            else
            {
                Console.WriteLine("FAILURE!");
            }


            return(report.Result == DoctorResult.Success ? 0 : 1);
        }
Example #7
0
        public static List <Report> ShowReport(DoctorReport value)
        {
            Console.WriteLine("Show Report start");
            var         connString = "mongodb://127.0.0.1:27017";
            MongoClient client     = new MongoClient(connString);
            var         db         = client.GetDatabase("dataPSTL");
            var         collection = db.GetCollection <Report>("Report");

            var firstFilter = Builders <Report> .Filter.Eq("idDoctor", value.userId);

            var cursor = collection.Find(firstFilter);

            return(cursor.ToList());
        }
        public void Use_configuration_positive_case()
        {
            // The "age" argument to the constructor is an integer, so 34 is okay

            DoctorReport report =
                fetchReport <BootstrapperThatDependsOnConfigFile>(
                    @"
<configuration>
  <appSettings>
    <add key='age' value='34'/>
  </appSettings>
</configuration>
");

            report.Result.ShouldEqual(DoctorResult.Success);
        }
        public void Use_configuration_negative_case()
        {
            // "age" is numeric, so "abc" will blow up with parse errors

            DoctorReport report =
                fetchReport <BootstrapperThatDependsOnConfigFile>(
                    @"
<configuration>
  <appSettings>
    <add key='age' value='abc'/>
  </appSettings>
</configuration>
");

            report.Result.ShouldEqual(DoctorResult.BootstrapperFailure);
        }
        public async Task <ActionResult> DoctorReport(int id)
        {
            User         user   = (User)Session["currentUser"];
            DoctorReport report = await db.DoctorReports.FindAsync(id);

            List <int>    symptomsId = Symptom.GetSymptomsInt(report.IdSymptoms);
            List <string> symptoms   = new List <string>();

            foreach (var symptomId in symptomsId)
            {
                Symptom s = db.Symptoms.Find(symptomId);
                symptoms.Add(s.Name);
            }
            ViewBag.symptoms = symptoms;
            return(View(report));
        }