forked from aspnet/AspNetWebStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleRoleProviderTest.cs
More file actions
53 lines (47 loc) · 1.59 KB
/
Copy pathSimpleRoleProviderTest.cs
File metadata and controls
53 lines (47 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// 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.ComponentModel;
using Microsoft.TestCommon;
namespace WebMatrix.WebData.Test
{
public class SimpleRoleProviderTest
{
[Theory]
[ReplaceCulture]
[InlineData(-1, false)]
[InlineData(0, true)]
[InlineData(1, true)]
[InlineData(2, false)]
public void SimpleRoleProvider_CasingBehavior_ValidatesRange(int value, bool isValid)
{
// Arrange
var provider = new SimpleRoleProvider();
var message =
"The value of argument 'value' (" + value + ") is invalid for Enum type " +
"'SimpleMembershipProviderCasingBehavior'." + Environment.NewLine +
"Parameter name: value";
// Act
Exception exception = null;
try
{
provider.CasingBehavior = (SimpleMembershipProviderCasingBehavior)value;
}
catch (Exception ex)
{
exception = ex;
}
// Assert
if (isValid)
{
Assert.Equal((SimpleMembershipProviderCasingBehavior)value, provider.CasingBehavior);
}
else
{
Assert.NotNull(exception);
Assert.IsAssignableFrom<InvalidEnumArgumentException>(exception);
Assert.Equal(message, exception.Message);
}
}
}
}