public async Task Then_Distinct_Providers_Are_Loaded_Into_The_Import_Table( [Frozen] Mock <IProviderStandardImportRepository> providerStandardImportRepository, [Frozen] Mock <IProviderImportRepository> providerImportRepository, [Frozen] Mock <IProviderStandardLocationImportRepository> providerStandardLocationImportRepository, [Frozen] Mock <IStandardLocationImportRepository> standardLocationImportRepository, [Frozen] Mock <ICourseDirectoryService> service, Domain.ImportTypes.Provider providerImportDuplicate, List <Domain.ImportTypes.Provider> providerImports, CourseLocation courseLocation, ProviderCourseImportService providerCourseImportService) { //Arrange providerImports.Add(providerImportDuplicate); providerImports.Add(providerImportDuplicate); service.Setup(x => x.GetProviderCourseInformation()).ReturnsAsync(providerImports); //Act await providerCourseImportService.ImportProviderCourses(); //Assert providerImportRepository.Verify(x => x.InsertMany(It.Is <List <ProviderImport> >( c => c.Count.Equals(providerImports.Count - 1) ) ), Times.Once); }
public void Then_Maps_The_Fields(CourseLocation providerCourseLocation) { var actual = (StandardLocationImport)providerCourseLocation; actual.Should().BeEquivalentTo(providerCourseLocation, options => options.Excluding(c => c.Address).Excluding(c => c.Id)); actual.Should().BeEquivalentTo(providerCourseLocation.Address); actual.LocationId.Should().Be(providerCourseLocation.Id); }
public ActionResult DeleteConfirmed(int id) { CourseLocation courseLocation = db.CourseLocations.Find(id); db.CourseLocations.Remove(courseLocation); db.SaveChanges(); return(RedirectToAction("Index")); }
public static CourseLocation CreateCourseLocation(string dataAreaId, string courseLocation1, global::System.DateTimeOffset addressValidTo, global::System.DateTimeOffset addressValidFrom) { CourseLocation courseLocation = new CourseLocation(); courseLocation.dataAreaId = dataAreaId; courseLocation.CourseLocation1 = courseLocation1; courseLocation.AddressValidTo = addressValidTo; courseLocation.AddressValidFrom = addressValidFrom; return(courseLocation); }
public ActionResult Edit([Bind(Include = "CourseLocationID,CourseId,LocationID,Date")] CourseLocation courseLocation) { if (ModelState.IsValid) { db.Entry(courseLocation).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CourseId = new SelectList(db.Courses, "CourseID", "CourseName", courseLocation.CourseId); ViewBag.LocationID = new SelectList(db.Locations, "LocationID", "StoreNumber", courseLocation.LocationID); return(View(courseLocation)); }
// GET: CourseLocations/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CourseLocation courseLocation = db.CourseLocations.Find(id); if (courseLocation == null) { return(HttpNotFound()); } return(View(courseLocation)); }
// GET: CourseLocations/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CourseLocation courseLocation = db.CourseLocations.Find(id); if (courseLocation == null) { return(HttpNotFound()); } ViewBag.CourseId = new SelectList(db.Courses, "CourseID", "CourseName", courseLocation.CourseId); ViewBag.LocationID = new SelectList(db.Locations, "LocationID", "StoreNumber", courseLocation.LocationID); return(View(courseLocation)); }
public async Task Then_The_National_Flag_Is_Populated_From_Location_And_Provider_Standard_Information( [Frozen] Mock <IProviderStandardImportRepository> providerStandardImportRepository, [Frozen] Mock <IProviderImportRepository> providerImportRepository, [Frozen] Mock <IProviderStandardLocationImportRepository> providerStandardLocationImportRepository, [Frozen] Mock <IStandardLocationImportRepository> standardLocationImportRepository, [Frozen] Mock <ICourseDirectoryService> service, long locationId, Domain.ImportTypes.Provider providerImport, CourseStandard standardImport, CourseLocation locationImport, ProviderCourseImportService providerCourseImportService) { //Arrange locationImport.Address.Lat = 52.564269; locationImport.Address.Long = -1.466056; locationImport.Id = locationId; standardImport.Locations = new List <StandardLocation> { new StandardLocation { Radius = 500, Id = locationId, DeliveryModes = new List <string> { "100PercentEmployer" } } }; providerImport.Locations = new List <CourseLocation> { locationImport }; providerImport.Standards = new List <CourseStandard> { standardImport }; service.Setup(x => x.GetProviderCourseInformation()).ReturnsAsync(new List <Domain.ImportTypes.Provider> { providerImport }); //Act await providerCourseImportService.ImportProviderCourses(); //Assert providerStandardLocationImportRepository.Verify(x => x.InsertMany(It.Is <List <ProviderStandardLocationImport> >(c => c.TrueForAll(ps => ps.National)))); }
protected void Parse(string badgeData) { string[] commaDelimited = badgeData.Split(new char[] { ',' }); int i = 0; string item = String.Empty; Swipe swipe = null; Swipe previousSwipe = null; int locationId = 0; CourseLocation cl; _swipeList = new SwipeList(); foreach (string value in commaDelimited) { i++; item = value; if (item.StartsWith("\"")) { item = item.Substring(1, item.Length - 1); } if (item.EndsWith("\"")) { item = item.Substring(0, item.Length - 1); } if (i == 1) { _messageType = item; } else if (i == 4) { BadgeNo = int.Parse(item); } else if (i >= 12) { // control values are even (10,12,14,etc) // time values are odd (11,13,15,etc) // we ignore 10&11 because they are for the start location and are zero bool isLocation = (((i - 10) % 2) == 0); locationId = int.Parse(item); if (isLocation && ((locationId == 0) || (locationId >= 250))) { // reached end of list return; } else if (isLocation) { // This is ignored because part of the process is to ensure all locations // are loaded prior to an event. //if (!_map.Contains(locationId)) //{ // throw new Exception(String.Format("Could not find Location {0}!", locationId)); //} cl = new CourseLocation(_courseId, locationId); if (_locationMap.Contains(cl.FullId)) { swipe = new Swipe(_locationMap[cl.FullId], previousSwipe); previousSwipe = swipe; _swipeList.Add(swipe); } } else { if (swipe != null) { swipe.Cummulative = long.Parse(item); } } } } }