Making action selection logging not throw on 404
This commit is contained in:
parent
ba1884aacb
commit
fea30a4096
|
|
@ -75,7 +75,7 @@ namespace Microsoft.AspNet.Mvc.Logging
|
||||||
|
|
||||||
private string Formatter(ActionDescriptor descriptor)
|
private string Formatter(ActionDescriptor descriptor)
|
||||||
{
|
{
|
||||||
return descriptor.DisplayName;
|
return descriptor?.DisplayName ?? "No action selected";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNet.Mvc.Logging
|
||||||
|
{
|
||||||
|
public class DefaultActionSelectorSelectAsyncValuesTest
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void EmptyDefaultActionSelectorSelectAsyncValues_ReturnValue()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var logObject = new DefaultActionSelectorSelectAsyncValues();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = logObject.ToString();
|
||||||
|
|
||||||
|
var expected = "DefaultActionSelector.SelectAsync" + Environment.NewLine +
|
||||||
|
"\tActions matching route constraints: " + Environment.NewLine +
|
||||||
|
"\tActions matching action constraints: " + Environment.NewLine +
|
||||||
|
"\tFinal Matches: " + Environment.NewLine +
|
||||||
|
"\tSelected action: No action selected";
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.Equal(expected, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue