Esempio n. 1
0
        public async void Does_not_implicitly_run_child_validator_when_disabled()
        {
            var webApp = new WebAppFixture <StartupWithImplicitValidationDisabled>();
            var result = await webApp.GetErrors("ImplicitChildValidator", new FormData());

            result.Count.ShouldEqual(0);
        }
Esempio n. 2
0
        public MvcIntegrationTests(ITestOutputHelper output, WebAppFixture <Startup> webApp)
        {
            CultureScope.SetDefaultCulture();

            this._output = output;
            this._webApp = webApp;
        }
        public UnauthorizedAccessTests(WebAppFixture <Startup> webApp)
        {
            _webApp = webApp;

            _client = _webApp.TestClient;

            region = new Region
            {
                regionID   = 1,
                regionName = "Test",
                frequency  = 7,
                firstDate  = DateTime.Now,
                inactive   = false
            };

            route = new Route
            {
                routeID   = 1,
                routeName = "TestRoute",
                region    = region,
                completed = false,
                inactive  = false,
                routeDate = DateTime.Now
            };

            location = new Location
            {
                locationID   = 1,
                city         = "Saskatoon",
                address      = "123 Main Street",
                postalCode   = "A1A 1A1",
                province     = "SK",
                locationType = "PickUp",
                region       = region
            };

            subscriber = new Subscriber
            {
                subscriberID = 1,
                firstName    = "Brett",
                lastName     = "Hickie",
                email        = "*****@*****.**",
                phoneNumber  = "1234567890",
                locationID   = 1,
                location     = location
            };

            admin = new Admin
            {
                username = "******",
                password = "******", //The SHA-256 hash of Cosmo123
            };

            _webApp.Load(_webApp.DBContext);
            //SubscriberFixture.Reload(_webApp.DBContext);
            //RegionFixture.Load(_webApp.DBContext);
            //LocationFixture.Reload(_webApp.DBContext);
            //AdminFixture.Load(_webApp.DBContext);
        }
        public async void Executes_implicit_child_validator_and_mixes_with_IValidatableObject()
        {
            var app = new WebAppFixture <StartupWithImplicitValidationEnabled>();

            var result = await app.GetErrors("ImplicitChildImplementsIValidatableObject", new FormData());

            result.Count.ShouldEqual(3);
        }
        public async void Executes_implicit_child_validator_and_mixes_with_DataAnnotations()
        {
            var app = new WebAppFixture <StartupWithImplicitValidationEnabled>();

            var result = await app.GetErrors("ImplicitChildWithDataAnnotations", new FormData());

            result.Count.ShouldEqual(2);
        }
        public async void ImplicitValidation_enabled_but_validator_explicitly_set_only_exeuctes_once()
        {
            var app = new WebAppFixture <StartupWithImplicitValidationEnabled>();

            var result = await app.GetErrors("ImplicitAndExplicitChildValidator", new FormData());

            result.Count.ShouldEqual(1);
        }
        public async void Executes_implicit_child_validator_when_enabled()
        {
            var app = new WebAppFixture <StartupWithImplicitValidationEnabled>();

            var result = await app.GetErrors("ImplicitChildValidator", new FormData());

            result.Count.ShouldEqual(1);
            result[0].Name.ShouldEqual("Child.Name");
        }
        public async Task Does_not_use_both_dataannotations_and_fv_in_same_model_when_MVC_val_disabled()
        {
            var app = new WebAppFixture <StartupWithMvcValidationDisabled>();

            var result = await app.GetErrors("MultipleValidationStrategies", new FormData());

            result.Count.ShouldEqual(1);
            result[0].Message.ShouldEqual("'Some Other Property' must not be empty.");
        }
        public async void Executes_implicit_child_validator_when_enabled_does_not_execute_multiple_times()
        {
            var app = new WebAppFixture <StartupWithImplicitValidationEnabled>();

            var result = await app.GetErrors("ImplicitChildValidator", new FormData());

            result.Count.ShouldEqual(1);

            result = await app.GetErrors("ImplicitChildValidator", new FormData());

            result.Count.ShouldEqual(1);
        }
        public WebAppTests(WebAppFixture <Startup> webApp)
        {
            _webApp = webApp; //set this _webApp to the WebAppFixture that is passed in

            _client = _webApp.TestClient;

            admin = new Admin
            {
                username = "******",
                password = "******", //The SHA-256 hash of Cosmo123
            };
        }
Esempio n. 11
0
        protected void StartBrowser()
        {
            if (driver != null && !UseSharedDriver)
            {
                driver.Quit();
                driver = null;
            }

            driver = WebAppFixture.GetWebDriver(UseSharedDriver);
            if (UseSharedDriver)
            {
                ClearCookies();
            }
        }
        public async void When_skipping_children_does_not_leave_validation_state_unvalidated()
        {
            var    webApp = new WebAppFixture <StartupWithImplicitValidationDisabled>();
            string json   = @"{ Children: [ { Name: null } ] }";

            var request = new HttpRequestMessage(HttpMethod.Post, $"/Test/CheckUnvalidated");

            request.Content = new StringContent(json, Encoding.UTF8, "application/json");
            var responseMessage = await webApp.Client.SendAsync(request);

            responseMessage.EnsureSuccessStatusCode();
            var response = await responseMessage.Content.ReadAsStringAsync();

            response.ShouldEqual("0");
        }
        public SubscriberTests(WebAppFixture <Startup> webApp)
        {
            _webApp = webApp; //set this _webApp to the WebAppFixture that is passed in

            //Builds up a HTTP client object that handles redirects to the API
            //_client = _webApp.CreateClient(new WebApplicationFactoryClientOptions { AllowAutoRedirect = false });
            _client = _webApp.TestClient;

            //This sets up the TokenClient, which handles the authentication tokens that IdentityServer hands out upon user authorization
            //var disco = DiscoveryClient.GetAsync("https://localhost:5000").Result;
            //_tokenClient = new TokenClient(disco.TokenEndpoint, "ro.client", "secret");

            //var tokenResponse = _tokenClient.RequestResourceOwnerPasswordAsync("alice", "password", "api1").Result;
            //_client.SetBearerToken(tokenResponse.AccessToken);

            admin = new Admin
            {
                username = "******",
                password = "******", //The SHA-256 hash of Cosmo123
            };
        }
Esempio n. 14
0
 public RequestTest(WebAppFixture fixture)
     : base(fixture, "/payments")
 {
 }
 public PublisherServiceEventsTests(WebAppFixture factory)
 {
     _factory = factory;
 }
Esempio n. 16
0
 public GetTest(WebAppFixture fixture)
     : base(fixture, "/jobs/{JobId}")
 {
 }
 public ServiceProviderTests(WebAppFixture <StartupWithContainer> webApp)
 {
     _webApp = webApp;
 }
        private readonly WebAppFixture <Startup> _webApp; //WebAppFixture to be created using configurations found in Startup.cs
        //private readonly TokenClient _tokenClient;


        public RegionTests(WebAppFixture <Startup> webApp, ITestOutputHelper output)
        {
            _webApp = webApp; //set this _webApp to the WebAppFixture that is passed in
            _output = output;
            _client = _webApp.TestClient;
        }
Esempio n. 19
0
 public RegistryServiceEventsTests(WebAppFixture factory)
 {
     _factory = factory;
 }
Esempio n. 20
0
 public GetTest(WebAppFixture fixture)
     : base(fixture, "/payments/{PaymentId}")
 {
 }