public void ConfirmEmployerShouldSaveLocationTypeAndNumberOfPositionsInDB() { const int providerSiteId = 101282923; const int employerId = 100608868; const int numberOfPositions = 5; const bool isEmployerLocationMainApprenticeshipLocation = true; var vacancyGuid = Guid.NewGuid(); var viewModel = GetProviderSiteEmployerLinkViewModel(employerId, isEmployerLocationMainApprenticeshipLocation, numberOfPositions, providerSiteId, vacancyGuid); var savedVacancy = new MongoVacancy { VacancyGuid = vacancyGuid }; Collection.Save(savedVacancy); var vacancyPostingController = Container.GetInstance <VacancyPostingController>(); vacancyPostingController.ConfirmEmployer(viewModel); var vacancy = Collection.FindOneById(vacancyGuid); vacancy.IsEmployerLocationMainApprenticeshipLocation.Should().BeTrue(); vacancy.NumberOfPositions.Should().Be(numberOfPositions); }
public void ConfirmEmployerWithLocationTypeAsDifferentFromEmployerLocationShouldRedirectToLocationView() { const int providerSiteId = 101282923; const int employerId = 100608868; // const string ukprn = const bool isEmployerLocationMainApprenticeshipLocation = false; var vacancyGuid = Guid.NewGuid(); var viewModel = GetProviderSiteEmployerLinkViewModel(employerId, isEmployerLocationMainApprenticeshipLocation, null, providerSiteId, vacancyGuid); var savedVacancy = new MongoVacancy { VacancyGuid = vacancyGuid }; Collection.Save(savedVacancy); var vacancyPostingController = Container.GetInstance <VacancyPostingController>(); var result = vacancyPostingController.ConfirmEmployer(viewModel); result.Should().BeOfType <RedirectToRouteResult>(); var redirection = result as RedirectToRouteResult; redirection.RouteName.Should().Be("AddLocations"); }
public void AddLocationsShouldStoreLocationsInDB() { const string providerSiteErn = "101282923"; const string edsUrn = "100608868"; const string additionalLocationInformation = "additional location information"; var numberOfPositions = 5; var address1 = new VacancyLocationAddressViewModel { Address = { Postcode = "HA0 1TW", AddressLine1 = "Abbeydale Road", AddressLine4 = "Wembley" }, NumberOfPositions = numberOfPositions }; var vacancyGuid = Guid.NewGuid(); var viewModel = new LocationSearchViewModel { ProviderSiteEdsUrn = providerSiteErn, EmployerEdsUrn = edsUrn, AdditionalLocationInformation = additionalLocationInformation, Addresses = new List <VacancyLocationAddressViewModel> { address1 }, VacancyGuid = vacancyGuid }; var savedVacancy = new MongoVacancy { VacancyGuid = vacancyGuid }; Collection.Save(savedVacancy); var vacancyPostingController = Container.GetInstance <VacancyPostingController>(); var result = vacancyPostingController.Locations(viewModel); result.Should().BeOfType <RedirectToRouteResult>(); var redirection = result as RedirectToRouteResult; redirection.RouteName.Should().Be("CreateVacancy"); var vacancy = Collection.FindOneById(vacancyGuid); /*vacancy.LocationAddresses.Should().HaveCount(1); * vacancy.LocationAddresses[0].Address.AddressLine1.Should().Be(address1.Address.AddressLine1); * vacancy.LocationAddresses[0].Address.AddressLine2.Should().Be(address1.Address.AddressLine2); * vacancy.LocationAddresses[0].Address.AddressLine3.Should().Be(address1.Address.AddressLine3); * vacancy.LocationAddresses[0].Address.AddressLine4.Should().Be(address1.Address.AddressLine4); * vacancy.LocationAddresses[0].Address.Postcode.Should().Be(address1.Address.Postcode); * vacancy.LocationAddresses[0].NumberOfPositions.Should().Be(numberOfPositions); * vacancy.AdditionalLocationInformation.Should().Be(additionalLocationInformation);*/ }
private static void CheckAllCommentsAreNull(MongoVacancy clonedVacancy) { clonedVacancy.WorkingWeekComment.Should().BeNull(); clonedVacancy.ApprenticeshipLevelComment.Should().BeNull(); clonedVacancy.ClosingDateComment.Should().BeNull(); clonedVacancy.DesiredQualificationsComment.Should().BeNull(); clonedVacancy.DesiredSkillsComment.Should().BeNull(); clonedVacancy.DurationComment.Should().BeNull(); clonedVacancy.FirstQuestionComment.Should().BeNull(); clonedVacancy.FrameworkCodeNameComment.Should().BeNull(); clonedVacancy.FutureProspectsComment.Should().BeNull(); clonedVacancy.LongDescriptionComment.Should().BeNull(); }
private void InitializeDatabaseWithVacancy(MongoVacancy vacancy) { var mongoConnectionString = MongoConfiguration.VacancyDb; var mongoDbName = MongoUrl.Create(mongoConnectionString).DatabaseName; var database = new MongoClient(mongoConnectionString) .GetServer() .GetDatabase(mongoDbName); Collection = database.GetCollection <MongoVacancy>("apprenticeshipVacancies"); Collection.Save(vacancy); }
private void InitializeDatabaseWithVacancy(MongoVacancy vacancy) { Collection.Save(vacancy); }