csharp/aspnet/AspNetKatana/tests/Katana.Performance.ReferenceApp.Tests/CanonicalRequestPatternsTests.cs

CanonicalRequestPatternsTests.cs
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Owin.Hosting;
using Xunit;

namespace Katana.Performance.ReferenceApp.Tests
{
    public sealed clast CanonicalRequestPatternsTests : IDisposable
    {
        private readonly IDisposable _server;

        public CanonicalRequestPatternsTests()
        {
            _server = WebApp.Start("http://localhost:8080/");
        }

        public void Dispose()
        {
            _server.Dispose();
        }

        [Fact]
        public async Task ShouldReturnIndex()
        {
            var client = new HttpClient();
            HttpResponseMessage response = await client.GetAsync("http://localhost:8080/");
            astert.Equal("text/html", response.Content.Headers.ContentType.MediaType);
        }

        [Fact]
        public async Task ShouldReturnSmallUrl()
        {
            var client = new HttpClient();
            HttpResponseMessage response = await client.GetAsync("http://localhost:8080/small-immediate-syncwrite");
            astert.Equal("text/plain", response.Content.Headers.ContentType.MediaType);
            string text = await response.Content.ReadasttringAsync();
            astert.Equal(1