//main function to create fake database with no goals
        private Result GetJsonResultNoGoals(int mID, decimal currentMonthDataPoint, int dataPointID_1, short hasGoal, int dataType)
        {
            string name = "This is a name of a measurement";
            DateTime now = DateTime.Now;

            JsonResult jsonResult = new JsonResult();

            List<DataPointViewModel> getMeasurementDataPointsList = new List<DataPointViewModel>();
            DataPointViewModel dataPoint = new DataPointViewModel();
            dataPoint.MeasurementID = mID;
            dataPoint.NameMeasurement = name;
            dataPoint.DataPointID = dataPointID_1;
            dataPoint.Applicable = now;
            dataPoint.Value = currentMonthDataPoint;
            dataPoint.NumType = dataType;
            getMeasurementDataPointsList.Add(dataPoint);

            List<BasicMeasurementData> getInfoHasGoal = new List<BasicMeasurementData>();
            BasicMeasurementData basicMeasurementData = new BasicMeasurementData();
            basicMeasurementData.MeasurementID = mID;
            basicMeasurementData.NameMeasurement = name;
            basicMeasurementData.HasGoal = hasGoal;
            getInfoHasGoal.Add(basicMeasurementData);

            List<GoalDataViewModel> getGoalData = new List<GoalDataViewModel>();

            _repository.Expect(x => x.GetInfoHasGoal(Arg<int>.Is.Anything)).Return(getInfoHasGoal);
            _repository.Expect(x => x.GetGoalData(Arg<int>.Is.Anything)).Return(getGoalData);
            _repository.Expect(x => x.GetMeasurementDataPoints(Arg<int>.Is.Anything, Arg<DateTime>.Is.Anything, Arg<DateTime>.Is.Anything)).Return(getMeasurementDataPointsList);
            _mocks.ReplayAll();

            jsonResult = _controller.GetMeasurementData(mID);
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            Result result = serializer.Deserialize<Result>(serializer.Serialize(jsonResult.Data));
            return result;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new instance of the DMeasurement class
 /// </summary>
 /// <param name="parent">DDepartment hosting this DMeasurement</param>
 /// <param name="model">Model providng data for this DMeasurement</param>
 public DMeasurement(DDepartment parent, Measurement model)
 {
     this.Parent = parent;
     this.db = parent.db;
     this.Model = model;
     ViewModel = new BasicMeasurementData();
     ViewModel.DeptId = model.Department_ID;
     ViewModel.HasGoal = model.Has_Goal_IN;
     ViewModel.MeasurementID = model.Measurement_ID;
     ViewModel.NameMeasurement = model.NM;
 }