a575963da9
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
|
|
|
|
using Moq;
|
|
using Xunit;
|
|
using Assert = Microsoft.TestCommon.AssertEx;
|
|
|
|
namespace System.Web.Mvc.Test
|
|
{
|
|
public class AuthorizationContextTest
|
|
{
|
|
[Fact]
|
|
public void ConstructorThrowsIfActionDescriptorIsNull()
|
|
{
|
|
// Arrange
|
|
ControllerContext controllerContext = new Mock<ControllerContext>().Object;
|
|
ActionDescriptor actionDescriptor = null;
|
|
|
|
// Act & assert
|
|
Assert.ThrowsArgumentNull(
|
|
delegate { new AuthorizationContext(controllerContext, actionDescriptor); }, "actionDescriptor");
|
|
}
|
|
|
|
[Fact]
|
|
public void PropertiesAreSetByConstructor()
|
|
{
|
|
// Arrange
|
|
ControllerContext controllerContext = new Mock<ControllerContext>().Object;
|
|
ActionDescriptor actionDescriptor = new Mock<ActionDescriptor>().Object;
|
|
|
|
// Act
|
|
AuthorizationContext authorizationContext = new AuthorizationContext(controllerContext, actionDescriptor);
|
|
|
|
// Assert
|
|
Assert.Equal(actionDescriptor, authorizationContext.ActionDescriptor);
|
|
}
|
|
}
|
|
}
|