Exemple #1
0
        public When_Placement_Information_Is_Submitted_Above_Max_Placements()
        {
            var opportunityService = Substitute.For <IOpportunityService>();

            var viewModel = new PlacementInformationSaveViewModel
            {
                PlacementsKnown = true,
                Placements      = 1000
            };

            var config = new MapperConfiguration(c => c.AddMaps(typeof(EmployerMapper).Assembly));
            var mapper = new Mapper(config);

            _opportunityController = new OpportunityController(opportunityService, mapper);
            _result = _opportunityController.SavePlacementInformationAsync(viewModel).GetAwaiter().GetResult();
        }
Exemple #2
0
        public When_Placement_Information_Is_Submitted_For_Provision_Gap_With_No_Reason_And_There_Are_Search_Results()
        {
            var opportunityService = Substitute.For <IOpportunityService>();

            var viewModel = new PlacementInformationSaveViewModel
            {
                OpportunityId             = 1,
                OpportunityItemId         = 1,
                OpportunityType           = OpportunityType.ProvisionGap,
                SearchResultProviderCount = 1,
                NoSuitableStudent         = false,
                HadBadExperience          = false,
                ProvidersTooFarAway       = false
            };

            var config = new MapperConfiguration(c => c.AddMaps(typeof(EmployerMapper).Assembly));
            var mapper = new Mapper(config);

            _opportunityController = new OpportunityController(opportunityService, mapper);

            _result = _opportunityController.SavePlacementInformationAsync(viewModel).GetAwaiter().GetResult();
        }
Exemple #3
0
        public When_Placement_Information_Is_Submitted_For_Provision_Gap_With_No_Reason_And_There_Are_No_Search_Results()
        {
            _opportunityService = Substitute.For <IOpportunityService>();
            _opportunityService.GetSavedOpportunityItemCountAsync(1).Returns(0);

            var viewModel = new PlacementInformationSaveViewModel
            {
                OpportunityId             = 1,
                OpportunityItemId         = 2,
                OpportunityType           = OpportunityType.ProvisionGap,
                SearchResultProviderCount = 0,
                JobRole             = "Junior Tester",
                PlacementsKnown     = false,
                NoSuitableStudent   = false,
                HadBadExperience    = false,
                ProvidersTooFarAway = false
            };

            var httpContextAccessor = Substitute.For <IHttpContextAccessor>();

            var config = new MapperConfiguration(c =>
            {
                c.AddMaps(typeof(PlacementInformationSaveDtoMapper).Assembly);
                c.ConstructServicesUsing(type =>
                                         type.Name.Contains("LoggedInUserEmailResolver") ?
                                         new LoggedInUserEmailResolver <PlacementInformationSaveViewModel, PlacementInformationSaveDto>(httpContextAccessor) :
                                         type.Name.Contains("LoggedInUserNameResolver") ?
                                         (object)new LoggedInUserNameResolver <PlacementInformationSaveViewModel, PlacementInformationSaveDto>(httpContextAccessor) :
                                         type.Name.Contains("UtcNowResolver") ?
                                         new UtcNowResolver <PlacementInformationSaveViewModel, PlacementInformationSaveDto>(new DateTimeProvider()) :
                                         null);
            });
            var mapper = new Mapper(config);

            _opportunityController = new OpportunityController(_opportunityService, mapper);

            _result = _opportunityController.SavePlacementInformationAsync(viewModel).GetAwaiter().GetResult();
        }