| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using NUnit.Framework.Internal;
- using Quadarax.Foundation.Core.Value.Extensions;
- namespace qdr.fnd.core.test.Value
- {
- [TestFixture(Category = "Fnd.Core")]
- public class EnumExtTest : BaseTest
- {
- private enum TestEnum
- {
- One,
- Two,
- Three
- }
- private enum TestEnum2
- {
- One2,
- Two2,
- Three2
- }
- protected override void OnSetup()
- {
- }
- protected override void OnTearDown()
- {
- }
- [Test]
- public void InOK()
- {
- TestEnum value = TestEnum.Three;
- Assert.That(value.In(TestEnum.One), Is.False);
- Assert.That(value.In(TestEnum.One, TestEnum.Two), Is.False);
- Assert.That(value.In(TestEnum.One, TestEnum.Two, TestEnum.Three), Is.True);
- Assert.That(value.In(TestEnum.Three), Is.True);
- Assert.That(value.In("Three"), Is.False);
- Assert.That(value.In("TestEnum.Three"), Is.False);
- Assert.That(value.In("XX"), Is.False);
- }
- [Test]
- public void InFail()
- {
- TestEnum value = TestEnum.Three;
- // empty tenant code
- Assert.That(Assert.Throws<ArgumentNullException>(() =>
- value.In(null))?.ParamName,
- Is.EqualTo("values"));
- }
- }
- }
|