public void And_Greater_Than_One_Location_Then_False(ShortlistViewModel model) { foreach (var item in model.Shortlist) { item.Course.Title = "the same course title"; item.Course.Level = 1; } model.IsOneTable.Should().BeFalse(); }
public void And_Greater_Than_One_CourseTitle_Then_False(ShortlistViewModel model) { foreach (var item in model.Shortlist) { item.Course.Level = 1; item.LocationDescription = "the same location"; } model.IsOneTable.Should().BeFalse(); }
public void And_One_Title_And_One_Level_And_One_Location_Then_True(ShortlistViewModel model) { foreach (var item in model.Shortlist) { item.Course.Title = "the same course title"; item.Course.Level = 1; item.LocationDescription = "the same location"; } model.IsOneTable.Should().BeTrue(); }
public async Task <IActionResult> Index([FromQuery] string removed) { var cookie = _shortlistCookieService.Get(Constants.ShortlistCookieName); if (cookie == default) { return(View(new ShortlistViewModel())); } var result = await _mediator.Send( new GetShortlistForUserQuery { ShortlistUserId = cookie.ShortlistUserId }); var removedProviderName = string.Empty; if (!string.IsNullOrEmpty(removed)) { try { var base64EncodedBytes = WebEncoders.Base64UrlDecode(removed); removedProviderName = System.Text.Encoding.UTF8.GetString(_protector.Unprotect(base64EncodedBytes)); } catch (FormatException e) { _logger.LogInformation(e, "Unable to decode provider name from request"); } catch (CryptographicException e) { _logger.LogInformation(e, "Unable to decode provider name from request"); } } var viewModel = new ShortlistViewModel { Shortlist = result.Shortlist.Select(item => (ShortlistItemViewModel)item).ToList(), Removed = removedProviderName, HelpBaseUrl = _config.EmployerDemandFeatureToggle ? _config.EmployerDemandUrl : "" }; return(View(viewModel)); }
public void Then_The_Expiry_Text_Is_Correctly_Set_When_No_Items(ShortlistViewModel model) { model.Shortlist = new List <ShortlistItemViewModel>(); model.ExpiryDateText.Should().BeEmpty(); }
public void Then_The_Expiry_Text_Is_Correctly_Set(ShortlistViewModel model) { var maxDate = model.Shortlist.Select(c => c.CreatedDate).Max(); model.ExpiryDateText.Should().Be($"We will save your shortlist until {maxDate.AddDays(30):dd MMMM yyyy}."); }
public void Then_Shortlist_Default_Is_Empty_List() { var actual = new ShortlistViewModel(); actual.Shortlist.Should().BeEmpty(); }