/
githubmirror
/
aspnetcore
Обзор
Документация
Войти
/
githubmirror
/
aspnetcore
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Middleware/Rewrite/test/IISUrlRewrite/RewriteMapParserTests.cs
39 строк
1 KB
Shreyas Jejurkar
chore : Remove unwanted `using` statement (#39176)
02 янв 2022, 17:39
Не верифицирован
02 янв 2022, 17:39
c85baf8
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Xml.Linq; using Microsoft.AspNetCore.Rewrite.IISUrlRewrite; namespace Microsoft.AspNetCore.Rewrite.Tests.IISUrlRewrite; public class RewriteMapParserTests { [Fact] public void Should_parse_rewrite_map() { // arrange const string expectedMapName = "apiMap"; const string expectedKey = "api.test.com"; const string expectedValue = "test.com/api"; var xml = $@"<rewrite> <rewriteMaps> <rewriteMap name=""{expectedMapName}""> <add key=""{expectedKey}"" value=""{expectedValue}"" /> </rewriteMap> </rewriteMaps> </rewrite>"; // act var xmlDoc = XDocument.Load(new StringReader(xml), LoadOptions.SetLineInfo); var xmlRoot = xmlDoc.Descendants(RewriteTags.Rewrite).FirstOrDefault(); var actualMaps = RewriteMapParser.Parse(xmlRoot); // assert Assert.Equal(1, actualMaps.Count); var actualMap = actualMaps[expectedMapName]; Assert.NotNull(actualMap); Assert.Equal(expectedMapName, actualMap.Name); Assert.Equal(expectedValue, actualMap[expectedKey]); } }