onebeyond/onebeyond-studio-core

View on GitHub
src/OneBeyond.Studio.Application.SharedKernel.Tests/Authorization/AuthorizationPolicyAttributeTests.cs

Summary

Maintainability
A
0 mins
Test Coverage
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OneBeyond.Studio.Domain.SharedKernel.Authorization;

namespace OneBeyond.Studio.Application.SharedKernel.Tests.Authorization;

[TestClass]
public sealed class AuthorizationPolicyAttributeTests
{
    [TestMethod]
    public void TestAuthorizationPolicyAttributeThrowsExceptionWhenNoRequirementsProvided()
    {
        try
        {
            var policy = new AuthorizationPolicyAttribute();

            Assert.Fail();
        }
        catch (ArgumentException exception)
        {
            Assert.AreEqual("Empty collection is not allowed. (Parameter 'requirementTypes')", exception.Message);
            Assert.AreEqual("requirementTypes", exception.ParamName);
        }
    }
}