/
githubmirror
/
aspnetcore
Обзор
Документация
Войти
/
githubmirror
/
aspnetcore
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Extensions/Features/test/FeatureCollectionExtensionsTests.cs
38 строк
990 B
Michael Staib
FlyBy typo fix in FeatureCollectionExtensions.cs (#55217)
22 апр 2024, 22:58
Не верифицирован
22 апр 2024, 22:58
473da40
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using Xunit; namespace Microsoft.AspNetCore.Http.Features; public class FeatureCollectionExtensionsTests { [Fact] public void AddedFeatureGetsReturned() { // Arrange var features = new FeatureCollection(); var thing = new Thing(); features.Set<IThing>(thing); // Act var retrievedThing = features.GetRequiredFeature<IThing>(); // Assert Assert.NotNull(retrievedThing); Assert.Equal(retrievedThing, thing); } [Fact] public void ExceptionThrown_WhenAskedForUnknownFeature() { // Arrange var features = new FeatureCollection(); var thing = new Thing(); features.Set<IThing>(thing); // Assert Assert.Throws<InvalidOperationException>(() => features.GetRequiredFeature<object>()); } }