blob: f61b34e08c5751db97a4cdf1e3483d7bcdfebe0c (
plain)
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
|
//-----------------------------------------------------------------------
// <copyright file="CommonConsumerBaseTest.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace DotNetOAuth.Test.CommonConsumers {
using System.Collections.Generic;
using System.Linq;
using DotNetOAuth.CommonConsumers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class CommonConsumerBaseTest : TestBase {
private enum SomeFlags : int {
None = 0,
Flag1 = 0x1,
Flag2 = 0x2,
Flag1and2 = 0x3,
Flag3 = 0x4,
All = 0x7,
}
[TestMethod]
public void GetIndividualFlagsTest() {
Assert.IsFalse(CommonConsumerBase_Accessor.GetIndividualFlags(SomeFlags.None).Any());
Assert.AreEqual(SomeFlags.Flag1, (SomeFlags)CommonConsumerBase_Accessor.GetIndividualFlags(SomeFlags.Flag1).Single());
IList<long> flags = CommonConsumerBase_Accessor.GetIndividualFlags(SomeFlags.Flag1and2).ToList();
Assert.AreEqual(SomeFlags.Flag1, (SomeFlags)flags[0]);
Assert.AreEqual(SomeFlags.Flag2, (SomeFlags)flags[1]);
flags = CommonConsumerBase_Accessor.GetIndividualFlags(SomeFlags.All).ToList();
Assert.AreEqual(SomeFlags.Flag1, (SomeFlags)flags[0]);
Assert.AreEqual(SomeFlags.Flag2, (SomeFlags)flags[1]);
Assert.AreEqual(SomeFlags.Flag3, (SomeFlags)flags[2]);
}
}
}
|