public override void Given()
        {
            Ukprn = 10011881;
            var httpContext = new ClaimsIdentityBuilder <ProviderController>(Controller)
                              .Add(CustomClaimTypes.Ukprn, Ukprn.ToString())
                              .Build()
                              .HttpContext;

            HttpContextAccessor.HttpContext.Returns(httpContext);
            mockresult = new YourProvidersViewModel
            {
                Providers = new List <ProviderDetailsViewModel> {
                    new ProviderDetailsViewModel
                    {
                        ProviderId  = 1,
                        DisplayName = "Test",
                        Ukprn       = 10000111
                    },
                    new ProviderDetailsViewModel
                    {
                        ProviderId  = 2,
                        DisplayName = "Display",
                        Ukprn       = 10000112
                    }
                }
            };

            ProviderLoader.GetYourProvidersAsync(Ukprn).Returns(mockresult);
        }
예제 #2
0
        public override void Given()
        {
            var httpContext = new ClaimsIdentityBuilder <ProviderController>(Controller)
                              .Add(CustomClaimTypes.Ukprn, Ukprn.ToString())
                              .Build()
                              .HttpContext;

            HttpContextAccessor.HttpContext.Returns(httpContext);

            ProviderLoader.IsAnyProviderSetupCompletedAsync(Ukprn).Returns(true);

            _mockresult = new ProviderTlevelsViewModel
            {
                ProviderId  = 1,
                DisplayName = _searchText,
                Ukprn       = 10000111,
                IsAddTlevel = true,
                Tlevels     = new List <ProviderTlevelViewModel>
                {
                    new ProviderTlevelViewModel {
                        TqAwardingOrganisationId = 1, TlProviderId = 1, TlevelTitle = "Route1: Pathway1"
                    },
                    new ProviderTlevelViewModel {
                        TqAwardingOrganisationId = 1, TlProviderId = 1, TlevelTitle = "Route1: Pathway1"
                    }
                }
            };

            ProviderLoader.GetSelectProviderTlevelsAsync(Arg.Any <long>(), Arg.Any <int>()).Returns(_mockresult);
        }
        public AuthorizationContextProviderTestsFixture SetValidUkprn()
        {
            Ukprn           = 456;
            UkprnClaimValue = Ukprn.ToString();

            var ukprnClaimValue = UkprnClaimValue;

            AuthenticationService.Setup(a => a.TryGetUserClaimValue(ProviderClaims.Ukprn, out ukprnClaimValue)).Returns(true);

            return(this);
        }
        public override void Given()
        {
            var httpContext = new ClaimsIdentityBuilder <ProviderController>(Controller)
                              .Add(CustomClaimTypes.Ukprn, Ukprn.ToString())
                              .Build()
                              .HttpContext;

            HttpContextAccessor.HttpContext.Returns(httpContext);

            ProviderLoader.IsAnyProviderSetupCompletedAsync(Ukprn).Returns(true);
        }
예제 #5
0
        public override void Given()
        {
            Ukprn        = 10011881;
            TqProviderId = 0;
            var httpContext = new ClaimsIdentityBuilder <ProviderController>(Controller)
                              .Add(CustomClaimTypes.Ukprn, Ukprn.ToString())
                              .Build()
                              .HttpContext;

            HttpContextAccessor.HttpContext.Returns(httpContext);

            ViewModel = null;
        }
        public bool IsValid()
        {
            if (string.IsNullOrEmpty(Name))
            {
                return(false);
            }

            if (Ukprn.ToString().Length != 8)
            {
                return(false);
            }

            return(true);
        }
        public override void Given()
        {
            Ukprn = 10011881;
            var httpContext = new ClaimsIdentityBuilder <ProviderController>(Controller)
                              .Add(CustomClaimTypes.Ukprn, Ukprn.ToString())
                              .Build()
                              .HttpContext;

            HttpContextAccessor.HttpContext.Returns(httpContext);

            var mockresult = new YourProvidersViewModel();

            ProviderLoader.GetYourProvidersAsync(Ukprn)
            .Returns(mockresult);
        }
        public override void Given()
        {
            Ukprn        = 10011881;
            TqProviderId = 0;
            var httpContext = new ClaimsIdentityBuilder <ProviderController>(Controller)
                              .Add(CustomClaimTypes.Ukprn, Ukprn.ToString())
                              .Build()
                              .HttpContext;

            HttpContextAccessor.HttpContext.Returns(httpContext);

            ProviderTlevelDetailsViewModel mockresult = null;

            ProviderLoader.GetTqProviderTlevelDetailsAsync(Ukprn, TqProviderId)
            .Returns(mockresult);
        }
예제 #9
0
        public override void Given()
        {
            Ukprn      = 10011881;
            ProviderId = 1;
            var httpContext = new ClaimsIdentityBuilder <ProviderController>(Controller)
                              .Add(CustomClaimTypes.Ukprn, Ukprn.ToString())
                              .Build()
                              .HttpContext;

            HttpContextAccessor.HttpContext.Returns(httpContext);

            ProviderTlevelsViewModel mockresult = null;

            ProviderLoader.GetSelectProviderTlevelsAsync(Arg.Any <long>(), Arg.Any <int>())
            .Returns(mockresult);
        }
        public override void Given()
        {
            var httpContext = new ClaimsIdentityBuilder <ProviderController>(Controller)
                              .Add(CustomClaimTypes.Ukprn, Ukprn.ToString())
                              .Build()
                              .HttpContext;

            HttpContextAccessor.HttpContext.Returns(httpContext);

            mockresult = new ProviderTlevelsViewModel
            {
                ProviderId  = 1,
                DisplayName = "Test",
                Ukprn       = 10000111,
                Tlevels     = new List <ProviderTlevelViewModel>()
            };

            ProviderLoader.GetSelectProviderTlevelsAsync(Arg.Any <long>(), Arg.Any <int>()).Returns(mockresult);
        }
        public override void Given()
        {
            Ukprn        = 1000001;
            TqProviderId = 1;
            TlProviderId = 5;

            var httpContext = new ClaimsIdentityBuilder <ProviderController>(Controller)
                              .Add(CustomClaimTypes.Ukprn, Ukprn.ToString())
                              .Build()
                              .HttpContext;

            HttpContextAccessor.HttpContext.Returns(httpContext);

            TempData            = new TempDataDictionary(HttpContextAccessor.HttpContext, Substitute.For <ITempDataProvider>());
            Controller.TempData = TempData;

            ViewModel = new ProviderTlevelDetailsViewModel {
                Id = TqProviderId, TlProviderId = TlProviderId, CanRemoveTlevel = true, ShowBackToProvidersLink = true
            };
            ProviderLoader.RemoveTqProviderTlevelAsync(Ukprn, TqProviderId).Returns(true);
        }
        public override void Given()
        {
            Ukprn        = 10011881;
            TqProviderId = 1;

            var httpContext = new ClaimsIdentityBuilder <ProviderController>(Controller)
                              .Add(CustomClaimTypes.Ukprn, Ukprn.ToString())
                              .Build()
                              .HttpContext;

            HttpContextAccessor.HttpContext.Returns(httpContext);

            mockresult = new ProviderTlevelDetailsViewModel
            {
                Id           = _tlProviderId,
                DisplayName  = "Test",
                Ukprn        = 10000111,
                TlevelTitle  = "Test Title",
                TlProviderId = _tlProviderId
            };

            ProviderLoader.GetTqProviderTlevelDetailsAsync(Ukprn, TqProviderId).Returns(mockresult);
        }