private ViewModel CreateViewModel(TLevel tLevel) => new ViewModel() { TLevelId = tLevel.TLevelId, LocationVenueNames = tLevel.Locations.Select(l => l.VenueName).ToArray(), StartDate = tLevel.StartDate, TLevelName = tLevel.TLevelDefinition.Name, YourReference = tLevel.YourReference };
public void AddLevel(string name, int needExp, int allowPoints) { TLevel level = new TLevel(name, needExp, allowPoints); LevelList.Add(level); }
static void AssertHasTLevel(JToken[] tLevels, CosmosModels.Provider provider, Provider sqlProvider, IReadOnlyCollection <Venue> venues, TLevel expectedTLevel, CosmosModels.FeChoice feChoice) { var tLevel = tLevels.SingleOrDefault(t => t["tLevelId"].ToObject <Guid>() == expectedTLevel.TLevelId); tLevel.Should().NotBeNull(); var providerContact = provider.ProviderContact.SingleOrDefault(c => c.ContactType == "P"); using (new AssertionScope()) { tLevel["offeringType"].ToObject <string>().Should().Be("TLevel"); tLevel["tLevelDefinitionId"].ToObject <Guid>().Should().Be(expectedTLevel.TLevelDefinition.TLevelDefinitionId); tLevel["qualification"]["tLevelName"].ToObject <string>().Should().Be(expectedTLevel.TLevelDefinition.Name); tLevel["qualification"]["qualificationLevel"].ToObject <string>().Should().Be(expectedTLevel.TLevelDefinition.QualificationLevel.ToString()); tLevel["qualification"]["frameworkCode"].ToObject <int>().Should().Be(expectedTLevel.TLevelDefinition.FrameworkCode); tLevel["qualification"]["progType"].ToObject <int>().Should().Be(expectedTLevel.TLevelDefinition.ProgType); tLevel["provider"]["providerName"].ToObject <string>().Should().Be(sqlProvider.DisplayName); tLevel["provider"]["ukprn"].ToObject <string>().Should().Be(provider.Ukprn.ToString()); tLevel["provider"]["addressLine1"].ToObject <string>().Should().Be($"{providerContact?.ContactAddress?.SAON?.Description} {providerContact?.ContactAddress?.PAON?.Description} {providerContact?.ContactAddress?.StreetDescription}"); tLevel["provider"]["addressLine2"].ToObject <string>().Should().Be(providerContact?.ContactAddress?.Locality); tLevel["provider"]["town"].ToObject <string>().Should().Be(providerContact?.ContactAddress?.PostTown); tLevel["provider"]["postcode"].ToObject <string>().Should().Be(providerContact?.ContactAddress?.PostCode); tLevel["provider"]["county"].ToObject <string>().Should().Be(providerContact?.ContactAddress?.County); tLevel["provider"]["email"].ToObject <string>().Should().Be(providerContact?.ContactEmail); tLevel["provider"]["telephone"].ToObject <string>().Should().Be(providerContact?.ContactTelephone1); tLevel["provider"]["fax"].ToObject <string>().Should().Be(providerContact?.ContactFax); tLevel["provider"]["website"].ToObject <string>().Should().Be($"http://{providerContact?.ContactWebsiteAddress}"); tLevel["provider"]["learnerSatisfaction"].ToObject <decimal?>().Should().Be(feChoice?.LearnerSatisfaction); tLevel["provider"]["employerSatisfaction"].ToObject <decimal?>().Should().Be(feChoice?.EmployerSatisfaction); tLevel["whoFor"].ToObject <string>().Should().Be(expectedTLevel.WhoFor); tLevel["entryRequirements"].ToObject <string>().Should().Be(expectedTLevel.EntryRequirements); tLevel["whatYoullLearn"].ToObject <string>().Should().Be(expectedTLevel.WhatYoullLearn); tLevel["howYoullLearn"].ToObject <string>().Should().Be(expectedTLevel.HowYoullLearn); tLevel["howYoullBeAssessed"].ToObject <string>().Should().Be(expectedTLevel.HowYoullBeAssessed); tLevel["whatYouCanDoNext"].ToObject <string>().Should().Be(expectedTLevel.WhatYouCanDoNext); tLevel["website"].ToObject <string>().Should().Be($"http://{expectedTLevel.Website}"); tLevel["startDate"].ToObject <DateTime>().Should().Be(expectedTLevel.StartDate); tLevel["deliveryMode"].ToObject <string>().Should().Be("ClassroomBased"); tLevel["attendancePattern"].ToObject <string>().Should().Be("Daytime"); tLevel["studyMode"].ToObject <string>().Should().Be("FullTime"); tLevel["durationUnit"].ToObject <string>().Should().Be("Years"); tLevel["durationValue"].ToObject <int>().Should().Be(2); tLevel["cost"].ToObject <decimal?>().Should().BeNull(); tLevel["costDescription"].ToObject <string>().Should().Be("T Levels are currently only available to 16-19 year olds. Contact us for details of other suitable courses."); var locations = tLevel["locations"].ToArray(); locations.Length.Should().Be(expectedTLevel.Locations.Count); foreach (var expectedLocation in expectedTLevel.Locations) { var location = locations.SingleOrDefault(l => l["tLevelLocationId"].ToObject <Guid>() == expectedLocation.TLevelLocationId); location.Should().NotBeNull(); var expectedVenue = venues.Single(v => v.VenueId == expectedLocation.VenueId); location["venueName"].ToObject <string>().Should().Be(expectedVenue.VenueName); location["addressLine1"].ToObject <string>().Should().Be(expectedVenue.AddressLine1); location["addressLine2"].ToObject <string>().Should().Be(expectedVenue.AddressLine2); location["town"].ToObject <string>().Should().Be(expectedVenue.Town); location["county"].ToObject <string>().Should().Be(expectedVenue.County); location["postcode"].ToObject <string>().Should().Be(expectedVenue.Postcode); location["telephone"].ToObject <string>().Should().Be(expectedVenue.Telephone); location["email"].ToObject <string>().Should().Be(expectedVenue.Email); location["website"].ToObject <string>().Should().Be($"http://{expectedVenue.Website}"); location["latitude"].ToObject <decimal>().Should().Be(Convert.ToDecimal(expectedVenue.Latitude)); location["longitude"].ToObject <decimal>().Should().Be(Convert.ToDecimal(expectedVenue.Longitude)); } } }