mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 17:10:20 -10:00
42 lines
1.3 KiB
C#
42 lines
1.3 KiB
C#
// -----------------------------------------------------------------------
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// -----------------------------------------------------------------------
|
|
using System;
|
|
using System.ComponentModel.Composition;
|
|
using System.UnitTesting;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
namespace System.ComponentModel.Composition
|
|
{
|
|
[TestClass]
|
|
public class PartCreationPolicyAttributeTests
|
|
{
|
|
[TestMethod]
|
|
public void Constructor_ShouldSetCreationPolicyToGivenValue()
|
|
{
|
|
var expectations = Expectations.GetEnumValues<CreationPolicy>();
|
|
|
|
foreach (var e in expectations)
|
|
{
|
|
var attribute = new PartCreationPolicyAttribute(e);
|
|
|
|
Assert.AreEqual(e, attribute.CreationPolicy);
|
|
}
|
|
}
|
|
|
|
[TestMethod]
|
|
public void Constructor_OutOfRangeValueAsCreationPolicyArgument_ShouldSetCreationPolicy()
|
|
{ // Attributes should not throw exceptions
|
|
|
|
var expectations = Expectations.GetInvalidEnumValues<CreationPolicy>();
|
|
|
|
foreach (var e in expectations)
|
|
{
|
|
var attribute = new PartCreationPolicyAttribute(e);
|
|
|
|
Assert.AreEqual(e, attribute.CreationPolicy);
|
|
}
|
|
}
|
|
}
|
|
}
|