You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NuGetGallery/tests/NuGet.Services.BasicSearchT.../StartupFunctionalTests.cs

46 lines
1.4 KiB
C#

// 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.Net;
using System.Threading.Tasks;
using NuGet.Services.BasicSearchTests.TestSupport;
using Xunit;
namespace NuGet.Services.BasicSearchTests
{
public class StartupFunctionalTests
{
[Fact]
public async Task Ready()
{
// Arrange
using (var app = await StartedWebApp.StartAsync())
{
// Act
var response = await app.Client.GetAsync("/");
var content = await response.Content.ReadAsStringAsync();
// Assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Equal(content, "READY");
}
}
[Fact]
public async Task InvalidEndpoint()
{
// Arrange
using (var app = await StartedWebApp.StartAsync())
{
// Act
var response = await app.Client.GetAsync("/invalid");
var content = await response.Content.ReadAsStringAsync();
// Assert
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
Assert.Equal(content, "UNRECOGNIZED");
}
}
}
}