示例#1
0
        public async Task <ResetPasswordConfirmation> SendNewPasswordAsync(string email, string newPassword)
        {
            var resetPasswordResponse = await Client.SendAsync(_resetPasswordForm, new Dictionary <string, string>
            {
                ["Input_Email"]           = email,
                ["Input_Password"]        = newPassword,
                ["Input_ConfirmPassword"] = newPassword
            });

            var goToResetPasswordConfirmation     = ResponseAssert.IsRedirect(resetPasswordResponse);
            var resetPasswordConfirmationResponse = await Client.GetAsync(goToResetPasswordConfirmation);

            var resetPasswordConfirmation = await ResponseAssert.IsHtmlDocumentAsync(resetPasswordConfirmationResponse);

            return(new ResetPasswordConfirmation(Client, resetPasswordConfirmation, Context));
        }
        public async Task ArtistsCollection_Options_DeserialisesAndCorrect()
        {
            HttpResponseMessage response = await HttpClient.SendAsync(new HttpRequestMessage(HttpMethod.Options, "/artists"));

            ResponseAssert.Success(response);

            string json = await response.Content.ReadAsStringAsync();

            dynamic obj = JsonConvert.DeserializeObject(json);

            Assert.NotNull(obj);

            string description = obj.description;

            Assert.NotNull(description);
        }
示例#3
0
    public async Task <TwoFactorAuthentication> ClickTwoFactorLinkAsync(bool consent = true)
    {
        // Accept cookie consent if requested
        if (consent)
        {
            await UserStories.AcceptCookiePolicy(Client);
        }

        var goToTwoFactor = await Client.GetAsync(_twoFactorLink.Href);

        var twoFactor = await ResponseAssert.IsHtmlDocumentAsync(goToTwoFactor);

        var context = consent ? Context.WithCookieConsent() : Context;

        return(new TwoFactorAuthentication(Client, twoFactor, context));
    }
示例#4
0
        public async Task <Index> LoginValidUserAsync(string userName, string password)
        {
            var loggedIn = await SendLoginForm(userName, password);

            var loggedInLocation = ResponseAssert.IsRedirect(loggedIn);

            Assert.Equal(Index.Path, loggedInLocation.ToString());
            var indexResponse = await Client.GetAsync(loggedInLocation);

            var index = await ResponseAssert.IsHtmlDocumentAsync(indexResponse);

            return(new Index(
                       Client,
                       index,
                       Context.WithAuthenticatedUser().WithPasswordLogin()));
        }
        public async Task ArtistsCollection_GetWithFields_DeserialisesAndCorrect()
        {
            HttpResponseMessage response = await HttpClient.GetAsync("/artists?fields=id,name");

            ResponseAssert.Success(response);

            string json = await response.Content.ReadAsStringAsync();

            dynamic obj = JsonConvert.DeserializeObject(json);

            Assert.NotNull(obj);

            string name = obj[0].name;

            Assert.Equal(TestRepositories.ArtistName, name);
        }
        public async Task CreatesNationalCupSubType()
        {
            var response = await Client.UploadStatsAsync(@"
National Cup - Sun 19.00 CE(S)T 2017-12-31
Klasyfikacja końcowa po 24/24 konkursach

Poz.  Gracz                    Kraj        Ocena     I    II   III     N     Punkty
1.    Mariusz Sobon            POL          1638     5     6     4    23       1528
2.    Michał Kwiatkowski       POL          1645     2     6     3    23       1364
3.    Maciej Sylwestrzuk       POL          1731     8     1     1    16       1170");

            await ResponseAssert.Ok(response);

            var tournament = await Database.Query <Tournament>().FirstAsync();

            Assert.Equal("POL", tournament.SubType);
        }
示例#7
0
        public async Task Post_ToIdentityAccountRegisterAndAuthenticatedUser_RedirectsToLoginPage()
        {
            // Arrange

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            using var content = new StringContent(String.Empty);

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/Identity/Account/Register"), content, CancellationToken.None);

            // Assert

            ResponseAssert.VerifyMovedPermanently(response, new Uri("/Identity/Account/Login", UriKind.Relative));
        }
示例#8
0
        public async Task Post_ToIdentityAccountRegisterAndUnauthenticatedUser_RedirectsToLoginPage()
        {
            // Arrange

            await using var webApplicationFactory = new CustomWebApplicationFactory(authenticatedUser: null);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            using var content = new StringContent(String.Empty);

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/Identity/Account/Register"), content, CancellationToken.None);

            // Assert

            ResponseAssert.VerifyRedirect(response, new Uri("https://localhost:5001/Identity/Account/Login?ReturnUrl=%2FIdentity%2FAccount%2FRegister"));
        }
示例#9
0
        public async Task <RegisterConfirmation> SendEmailWithConfirmationAsync(string email, bool hasRealEmail)
        {
            var response = await Client.SendAsync(_emailForm, new Dictionary <string, string>
            {
                ["Input_Email"] = email
            });

            var redirect = ResponseAssert.IsRedirect(response);

            Assert.Equal(RegisterConfirmation.Path + "?email=" + email, redirect.ToString(), StringComparer.OrdinalIgnoreCase);

            var registerResponse = await Client.GetAsync(redirect);

            var register = await ResponseAssert.IsHtmlDocumentAsync(registerResponse);

            return(new RegisterConfirmation(Client, register, hasRealEmail ? Context.WithRealEmailSender() : Context));
        }
示例#10
0
        public async Task <RemoveExternalLogin> ManageExternalLoginAsync(string loginEmail)
        {
            var linkedExternalLogin = await Client.SendAsync(_externalLoginForm, new Dictionary <string, string>
            {
                ["Input_Login"] = loginEmail
            });

            var goToLinkedExternalLogin = ResponseAssert.IsRedirect(linkedExternalLogin);
            var externalLoginResponse   = await Client.GetAsync(goToLinkedExternalLogin);

            var goToManageExternalLogin     = ResponseAssert.IsRedirect(externalLoginResponse);
            var manageExternalLoginResponse = await Client.GetAsync(goToManageExternalLogin);

            var manageExternalLoginDocument = await ResponseAssert.IsHtmlDocumentAsync(manageExternalLoginResponse);

            return(new RemoveExternalLogin(Client, manageExternalLoginDocument, Context));
        }
        public async Task <Index> SubmitRegisterFormForValidUserAsync(string userName, string password)
        {
            var registered = await Client.SendAsync(_registerForm, new Dictionary <string, string>()
            {
                ["Input_Email"]           = userName,
                ["Input_Password"]        = password,
                ["Input_ConfirmPassword"] = password
            });

            var registeredLocation = ResponseAssert.IsRedirect(registered);

            Assert.Equal(Index.Path, registeredLocation.ToString());
            var indexResponse = await Client.GetAsync(registeredLocation);

            var index = await ResponseAssert.IsHtmlDocumentAsync(indexResponse);

            return(new Index(Client, index, Context.WithAuthenticatedUser()));
        }
        public async Task <RegisterConfirmation> SubmitRegisterFormWithConfirmation(string userName, string password, bool hasRealEmail = false)
        {
            var registered = await Client.SendAsync(_registerForm, new Dictionary <string, string>()
            {
                ["Input_Email"]           = userName,
                ["Input_Password"]        = password,
                ["Input_ConfirmPassword"] = password
            });

            var registeredLocation = ResponseAssert.IsRedirect(registered);

            Assert.Equal(RegisterConfirmation.Path + "?email=" + userName + "&returnUrl=%2F", registeredLocation.ToString());
            var registerResponse = await Client.GetAsync(registeredLocation);

            var register = await ResponseAssert.IsHtmlDocumentAsync(registerResponse);

            return(new RegisterConfirmation(Client, register, hasRealEmail ? Context.WithRealEmailSender() : Context));
        }
示例#13
0
    internal async Task <Index> Send2FACodeAsync(string twoFactorKey)
    {
        var code = EnableAuthenticator.ComputeCode(twoFactorKey);

        var response = await Client.SendAsync(_twoFactorForm, new Dictionary <string, string>
        {
            ["Input_TwoFactorCode"] = code
        });

        var goToIndex = ResponseAssert.IsRedirect(response);

        Assert.Equal(Index.Path, goToIndex.ToString());
        var indexResponse = await Client.GetAsync(goToIndex);

        var index = await ResponseAssert.IsHtmlDocumentAsync(indexResponse);

        return(new Index(Client, index, Context.WithAuthenticatedUser()));
    }
示例#14
0
        public async Task GetAllianceIcon()
        {
            var stubbedData = new
            {
                px128x128 = "https://images.evetech.net/Alliance/99000006_128.png",
                px64x64   = "https://images.evetech.net/Alliance/99000006_64.png"
            };

            MockGetRequest("/latest/alliances/*/icons", stubbedData);

            var result = await _esi.Alliance.GetAllianceIcon(1);

            ResponseAssert.IsSuccessful(result);
            Assert.IsNull(result.Message);
            Assert.IsNotNull(result.Data);
            Assert.AreEqual(stubbedData.px64x64, result.Data.Url64);
            Assert.AreEqual(stubbedData.px128x128, result.Data.Url128);
        }
示例#15
0
        public async Task Tracks_GetIDsWhereLiked_AllOdd()
        {
            HttpResponseMessage response = await HttpClient.GetAsync("/tracks?fields=id&liked=true&where=id<=10");

            ResponseAssert.Success(response);

            string json = await response.Content.ReadAsStringAsync();

            var objs = JsonConvert.DeserializeObject <List <dynamic> >(json);

            Assert.True(objs.Any());

            foreach (dynamic obj in objs)
            {
                int id = obj.id;
                Assert.Equal(1, id % 2); // weird bodge, in db all my likes are odd numbers
            }
        }
示例#16
0
        internal async Task <ShowRecoveryCodes> SendValidCodeAsync()
        {
            var authenticatorKey = _codeElement.TextContent.Replace(" ", "");

            Context.AuthenticatorKey = authenticatorKey;
            var verificationCode = ComputeCode(authenticatorKey);

            var sendCodeResponse = await Client.SendAsync(_sendCodeForm, new Dictionary <string, string>
            {
                ["Input_Code"] = verificationCode
            });

            var goToShowRecoveryCodes     = ResponseAssert.IsRedirect(sendCodeResponse);
            var showRecoveryCodesResponse = await Client.GetAsync(goToShowRecoveryCodes);

            var showRecoveryCodes = await ResponseAssert.IsHtmlDocumentAsync(showRecoveryCodesResponse);

            return(new ShowRecoveryCodes(Client, showRecoveryCodes, Context));
        }
        public async Task PostCreateRole_ForPrivilegedUser_CreatesRoleCorrectly()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("Name", "Some New Role"),
                new KeyValuePair <string, string>("Permissions[0].Assigned", "true"),
                new KeyValuePair <string, string>("Permissions[0].PermissionName", "Permissions.MoviesToGet.Add"),
                new KeyValuePair <string, string>("Permissions[1].Assigned", "true"),
                new KeyValuePair <string, string>("Permissions[1].PermissionName", "Permissions.MoviesToGet.Read"),
                new KeyValuePair <string, string>("Permissions[2].PermissionName", "Permissions.MoviesToGet.MoveToMoviesToSee"),
                new KeyValuePair <string, string>("Permissions[3].PermissionName", "Permissions.MoviesToGet.Delete"),
                new KeyValuePair <string, string>("Permissions[4].PermissionName", "Permissions.MoviesToSee.Add"),
                new KeyValuePair <string, string>("Permissions[5].Assigned", "true"),
                new KeyValuePair <string, string>("Permissions[5].PermissionName", "Permissions.MoviesToSee.Read"),
                new KeyValuePair <string, string>("Permissions[6].PermissionName", "Permissions.MoviesToSee.MarkAsSeen"),
                new KeyValuePair <string, string>("Permissions[7].PermissionName", "Permissions.MoviesToSee.Delete"),
                new KeyValuePair <string, string>("Permissions[0].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[1].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[2].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[3].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[4].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[5].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[6].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[7].Assigned", "false"),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/Roles/CreateRole"), formContent, CancellationToken.None);

            // Assert

            ResponseAssert.VerifyRedirect(response, new Uri("/Roles", UriKind.Relative));

            using var indexResponse = await client.GetAsync(new Uri ("https://localhost:5001/Roles"), CancellationToken.None);

            await ResponseAssert.VerifyPageLoaded(indexResponse);
        }
示例#18
0
        public async Task GetAllianceCorporationIds()
        {
            var stubbedData = new[]
            {
                98617312,
                98667839
            };

            MockGetRequest("/latest/alliances/*/corporations", stubbedData);

            var result = await _esi.Alliance.GetAllianceCorporationIds(1);

            ResponseAssert.IsSuccessful(result);
            Assert.IsNull(result.Message);
            Assert.IsNotNull(result.Data);
            Assert.IsTrue(result.Data.Length == 2);
            Assert.AreEqual(stubbedData[0], result.Data[0]);
            Assert.AreEqual(stubbedData[1], result.Data[1]);
        }
示例#19
0
        public async Task CreatesCompetition()
        {
            var response = await Client.UploadStatsAsync(@"
WC Wednesday A - 19.00 CE(S)T 2016-03-02
Park City HS134 Wyniki kwalifikacji (KO)

Poz.  Nr    Zawodnik                 Kraj        Ocena      Długość       Punkty Zakwalifik.
1.    32    SoBo                     POL          1660     127.65 m        131.5           Q
2.    28    Łukasz Bester            POL          1517     127.35 m        129.6            ");

            await ResponseAssert.Ok(response);

            var competitions = await Database.Query <Competition>().AllAsync();

            Assert.Single(competitions);

            Assert.Equal(1, competitions[0].FileNumber);
            Assert.True(competitions[0].KO);
        }
示例#20
0
        public async Task UpdateUser_ForPrivilegedUser_UpdatesUserCorrectly()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                // Here we delete role "Limited User" and add role "Privileged User".
                new KeyValuePair <string, string>("Roles[0].RoleName", "Administrator"),
                new KeyValuePair <string, string>("Roles[1].Assigned", "true"),
                new KeyValuePair <string, string>("Roles[1].RoleName", "Privileged User"),
                new KeyValuePair <string, string>("Roles[2].RoleName", "Limited User"),
                new KeyValuePair <string, string>("UserId", "5eb7eb9f1fdada19f4eb59b1"),
                new KeyValuePair <string, string>("Roles[0].Assigned", "false"),
                new KeyValuePair <string, string>("Roles[1].Assigned", "false"),
                new KeyValuePair <string, string>("Roles[2].Assigned", "false"),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/Users/UpdateUser"), formContent, CancellationToken.None);

            // Assert

            ResponseAssert.VerifyRedirect(response, new Uri("/Users", UriKind.Relative));

            using var indexResponse = await client.GetAsync(new Uri ("https://localhost:5001/Users"), CancellationToken.None);

            await ResponseAssert.VerifyPageLoaded(indexResponse);

            var expectedRoles = new[]
            {
                "Privileged User",
            };

            using var scopeServiceProvider = webApplicationFactory.Services.CreateScope();
            var userService  = scopeServiceProvider.ServiceProvider.GetRequiredService <IUserService>();
            var newUserRoles = await userService.GetUserRoles("5eb7eb9f1fdada19f4eb59b1", CancellationToken.None);

            newUserRoles.Select(r => r.RoleName).Should().BeEquivalentTo(expectedRoles, x => x.WithStrictOrdering());
        }
        public async Task HandlesJumpPoints()
        {
            var czeRespone = await Client.UploadStatsAsync(@"
Central European Four - 1st Mon 20.00 CE(S)T 2021-03-01
Resultater Etter 4/4 Renn

Plass Navn                     Nasjon   Rangeri.     I    II   III     N      Poeng
1.    Bartek Winczaszek        POL          1810     1     1     -     4     1137.6
2.    Dawid Milewski           POL          1581     -     1     -     4     1134.4
3.    Jacek Sterna             POL          1768     -     -     2     4     1134.1");

            await ResponseAssert.Ok(czeRespone);

            var tournaments = await Database.Query <Tournament>().AllAsync();

            var jumpers = await Database.Query <Jumper>().AllAsync();

            var finalStandings = await Database.Query <FinalStanding>().AllAsync();

            Assert.Single(tournaments);
            Assert.Equal(3, jumpers.Length);
            Assert.Equal(3, finalStandings.Length);

            Assert.Collection(finalStandings,
                              bartek =>
            {
                Assert.Equal(1137.6m, bartek.Points);
                Assert.Equal(100, bartek.CupPoints);
            },

                              dawid =>
            {
                Assert.Equal(1134.4m, dawid.Points);
                Assert.Equal(80, dawid.CupPoints);
            },

                              jacek =>
            {
                Assert.Equal(1134.1m, jacek.Points);
                Assert.Equal(60, jacek.CupPoints);
            });
        }
示例#22
0
        public async Task ConfirmMovieAdding_ForLimitedUser_RedirectsToAccessDeniedPage()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("NewMovieToSee.MovieUri", "https://www.kinopoisk.ru/film/111543/"),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.LimitedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/MoviesToSee/ConfirmMovieAdding"), formContent, CancellationToken.None);

            // Assert

            ResponseAssert.VerifyRedirect(response, new Uri("https://localhost:5001/Identity/Account/AccessDenied?ReturnUrl=%2FMoviesToSee%2FConfirmMovieAdding"));
        }
        public async Task MoveToMoviesToSee_ForLimitedUser_RedirectsToAccessDeniedPage()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("id", "5eac4f407a15596e90c09d7b"),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.LimitedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/MoviesToGet/MoveToMoviesToSee/5eac4f407a15596e90c09d7b"), formContent, CancellationToken.None);

            // Assert

            ResponseAssert.VerifyRedirect(response, new Uri("https://localhost:5001/Identity/Account/AccessDenied?ReturnUrl=%2FMoviesToGet%2FMoveToMoviesToSee%2F5eac4f407a15596e90c09d7b"));
        }
示例#24
0
        public async Task UploadEverythingInFolder(string path)
        {
            if (Directory.Exists(path))
            {
                var files = Directory.GetFiles(path, "*.txt");

                var sw = Stopwatch.StartNew();
                foreach (var file in files)
                {
                    var response =
                        await Client.UploadStatsAsync(File.ReadAllText(file), fileName : Path.GetFileName(file));

                    await ResponseAssert.Ok(response);
                }

                sw.Stop();

                _output.WriteLine($"Uploaded {files.Length} files in {sw.Elapsed}");
            }
        }
        public async Task ConfirmMovieAdding_ForPrivilegedUserAndMovieWithAllInfoMissing_ReturnsCorrectPage()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("NewMovieToGet.MovieUri", "https://www.kinopoisk.ru/film/13/"),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser, movieInfoProvider: FakeMovieInfoProvider.StubMovieInfoWithAllInfoMissing);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/MoviesToGet/ConfirmMovieAdding"), formContent, CancellationToken.None);

            // Assert

            await ResponseAssert.VerifyPageLoaded(response);
        }
示例#26
0
        public async Task ControllerAction_UnhandledExceptionIsThrown_ReturnsCorrectErrorPage()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("NewMovieToGet.MovieUri", "https://www.kinopoisk.ru/film/111543/"),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.LimitedUser, movieInfoProvider: FakeMovieInfoProvider.StubFailingProvider);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/MoviesToGet/ConfirmMovieAdding"), formContent, CancellationToken.None);

            // Assert

            await ResponseAssert.VerifyPageLoaded(response, HttpStatusCode.InternalServerError);
        }
示例#27
0
        public async Task DeleteUser_ForLimitedUser_RedirectsToAccessDeniedPage()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("id", "5eb7eb9f1fdada19f4eb59b1"),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.LimitedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/Users/DeleteUser"), formContent, CancellationToken.None);

            // Assert

            ResponseAssert.VerifyRedirect(response, new Uri("https://localhost:5001/Identity/Account/AccessDenied?ReturnUrl=%2FUsers%2FDeleteUser"));
        }
        public async Task CreatesTournament()
        {
            var response = await Client.UploadStatsAsync(@"
WC - Sunday 20.00 CE(S)T 2015-11-08
Final Results After 40/40 Hills

--- Ignored ---");

            await ResponseAssert.Ok(response);

            var tournament = await Database.Query <Tournament>().FirstAsync();

            var tournamentType = await Database.Query <TournamentType>()
                                 .Where("id = @Id", new { Id = tournament.TournamentTypeId })
                                 .FirstAsync();

            Assert.Equal("World Cup", tournamentType.Name);
            Assert.Equal(3, tournament.GameVersion);
            Assert.Equal("2015-11-08T20:00:00", tournament.Date.ToString("s"));
            Assert.Equal(40, tournament.HillCount);
        }
        public async Task CreatesCompetition()
        {
            var response = await Client.UploadStatsAsync(@"
WC Wednesday A - 19.00 CE(S)T 2016-03-02
Bad Mitterndorf HS200 Wyniki konkursu

Poz.  Nr    Zawodnik                 Kraj        Ocena      I seria     II seria       Punkty
1.    33    SoBo                     POL          1673      215.5 m      212.0 m        423.0
2.    34    Bartek Winczaszek        POL          1764      217.5 m      210.5 m        420.1",
                                                         fileName : "Bla bla bla Wyniki konkursu[2].txt");

            await ResponseAssert.Ok(response);

            var competition = await Database.Query <Competition>().FirstAsync();

            var hill = await Database.Query <Hill>().Where("id=" + competition.HillId).FirstAsync();

            Assert.Equal(2, competition.FileNumber);
            Assert.False(competition.KO);
            Assert.Equal("Bad Mitterndorf HS200", hill.Name);
        }
示例#30
0
        private async Task <IHtmlDocument> SendLoginForm(string userName)
        {
            var contosoResponse = await Client.SendAsync(_loginForm, new Dictionary <string, string>
            {
                ["Input_Login"] = userName
            });

            var goToExternalLogin     = ResponseAssert.IsRedirect(contosoResponse);
            var externalLogInResponse = await Client.GetAsync(goToExternalLogin);

            if (Context.ExistingUser)
            {
                var goToIndex     = ResponseAssert.IsRedirect(externalLogInResponse);
                var indexResponse = await Client.GetAsync(goToIndex);

                return(await ResponseAssert.IsHtmlDocumentAsync(indexResponse));
            }
            else
            {
                return(await ResponseAssert.IsHtmlDocumentAsync(externalLogInResponse));
            }
        }