Exemple #1
0
 public void MyTestCleanup()
 {
     if (_repo != null)
     {
         _repo.Dispose();
         _repo = null;
     }
 }
Exemple #2
0
    public static string GetBreezeMetadata(bool pretty = false)
    {
        var engine = new Engine().Execute("var setInterval;var setTimeout = setInterval = function(){}");     //if using an engine like V8.NET, would not be required - not part of DOM spec

        engine.Execute(File.ReadAllText(breezeJsPath));
        engine.Execute("var edmxMetadataStore = new breeze.MetadataStore();" +
                       "edmxMetadataStore.importMetadata(" + MedSimDtoRepository.GetEdmxMetadata() + ");" +
                       "edmxMetadataStore.exportMetadata();");
        var exportedMeta = JObject.Parse(engine.GetCompletionValue().AsString());

        AddValidators(exportedMeta);
        return(exportedMeta.ToString(pretty ? Formatting.Indented : Formatting.None));
    }
Exemple #3
0
        public void MyTestInitialize()
        {
            Guid userId;
            IEnumerable <string> roles;

            using (var db = new MedSimDbContext())
            {
                userId = (from u in db.Users
                          where u.Email == "*****@*****.**"
                          select u.Id).First();
                roles = (from r in db.Roles
                         where r.Users.Any(u => u.UserId == userId)
                         select r.Name).ToList();
            }
            _repo = new MedSimDtoRepository(new MockIPrincipal());
        }
Exemple #4
0
 public static ILookup <Guid, CourseDto> GetBookedManikins(IPrincipal user, Guid courseId, Guid[] departmentIds)
 {
     using (var repo = new MedSimDtoRepository(user))
     {
         var course = repo.Context.Courses.Include(c => c.CourseDays).Include(c => c.CourseFormat).AsNoTracking().First(c => c.Id == courseId);
         var start  = course.StartFacultyUtc;
         var finish = course.FinishCourseFacultyUtc();
         return((from csm in repo.GetCourseSlotManikins(new[] { "Course.CourseFormat.CourseType", "Course.Department.Institution", "Course.CourseDays", "Manikin" }, new string[0], '.')
                 let c = csm.Course
                         let lastDay = c.CourseDays.FirstOrDefault(cd => cd.Day == c.CourseFormat.DaysDuration)
                                       let cFinish = lastDay == null
                     ? DbFunctions.AddMinutes(c.StartFacultyUtc, c.DurationFacultyMins)
                     : DbFunctions.AddMinutes(lastDay.StartFacultyUtc, lastDay.DurationFacultyMins)
                                                     where departmentIds.Contains(csm.Manikin.DepartmentId) && c.Id != courseId && c.StartFacultyUtc <finish && cFinish> start
                                                     select new { csm.ManikinId, c })
                .ToLookup(a => a.ManikinId, a => a.c));
     }
 }
 public static IQueryable<CourseDto> GetCourseIncludes(MedSimDtoRepository repo)
 {
     return repo.GetCourses(_includeList);
 }
 public static DbQuery<Course> GetCourseIncludes(MedSimDtoRepository repo)
 {
     return GetCourseIncludes(repo.Context);
 }
Exemple #7
0
 public static IQueryable <CourseDto> GetCourseIncludes(MedSimDtoRepository repo)
 {
     return(repo.GetCourses(_includeList));
 }
Exemple #8
0
 public static DbQuery <Course> GetCourseIncludes(MedSimDtoRepository repo)
 {
     return(GetCourseIncludes(repo.Context));
 }