// 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.IO;
using Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite;
using Xunit;
namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite
{
public class FormatExceptionHandlingTests
{
[Theory]
[InlineData(
@"
",
"Match does not have an associated pattern attribute in condition")]
[InlineData(
@"
",
"Match does not have an associated pattern attribute in condition")]
[InlineData(
@"
",
"Missing close brace for parameter at string index: '6'")]
[InlineData(
@"
",
"Missing close brace for parameter at string index: '1'")]
public void ThrowFormatExceptionWithCorrectMessage(string input, string expected)
{
// Arrange, Act, Assert
var ex = Assert.Throws(() => new UrlRewriteFileParser().Parse(new StringReader(input)));
Assert.Equal(expected, ex.Message);
}
}
}