Welcome to mirror list, hosted at ThFree Co, Russian Federation.

RedirectResultTest.cs « test « Http.Results « Http « src - github.com/dotnet/aspnetcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2b0567e12abd4d53fc1622e9283722071e4b3ea1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.AspNetCore.Internal;
using Xunit;

namespace Microsoft.AspNetCore.Http.Result
{
    public class RedirectResultTest : RedirectResultTestBase
    {
        [Fact]
        public void RedirectResult_Constructor_WithParameterUrlPermanentAndPreservesMethod_SetsResultUrlPermanentAndPreservesMethod()
        {
            // Arrange
            var url = "/test/url";

            // Act
            var result = new RedirectResult(url, permanent: true, preserveMethod: true);

            // Assert
            Assert.True(result.PreserveMethod);
            Assert.True(result.Permanent);
            Assert.Same(url, result.Url);
        }

        protected override Task ExecuteAsync(HttpContext httpContext, string contentPath)
        {
            var redirectResult = new RedirectResult(contentPath, false, false);
            return redirectResult.ExecuteAsync(httpContext);
        }
    }
}