Ejemplo n.º 1
0
        public void Setup()
        {
            var members = FastEnum.GetMembers <Fruits>();

            this.Standard = members.ToDictionary(x => x.Value);
            this.Frozen   = members.ToFrozenDictionary(x => x.Value);
        }
Ejemplo n.º 2
0
        public void Setup()
        {
            var members = FastEnum.GetMembers <Fruits>();

            this.Standard          = members.ToDictionary(x => (int)x.Value);
            this.GenericsKeyFrozen = members.ToFrozenDictionary(x => (int)x.Value);
            this.IntKeyFrozen      = members.ToFrozenIntKeyDictionary(x => (int)x.Value);
        }
Ejemplo n.º 3
0
        public void Setup()
        {
            var members = FastEnum.GetMembers <Fruits>();

            this.Standard          = members.ToDictionary(x => x.Name);
            this.GenericsKeyFrozen = members.ToFrozenDictionary(x => x.Name);
            this.StringKeyFrozen   = members.ToFrozenStringKeyDictionary(x => x.Name);
            this.Table             = new Hashtable(members.Count);
            foreach (var x in members)
            {
                this.Table[x.Name] = x;
            }
        }
Ejemplo n.º 4
0
        public void GetMembers()
        {
            var expect = Enum.GetNames <TEnum>().Select(x => new Member <TEnum>(x)).ToArray();
            var actual = FastEnum.GetMembers <TEnum>();

            actual.Count.Should().Be(expect.Length);
            for (var i = 0; i < expect.Length; i++)
            {
                var a = actual[i];
                var e = expect[i];
                a.Value.Should().Be(e.Value);
                a.Name.Should().Be(e.Name);
                a.FieldInfo.Should().Be(e.FieldInfo);

                var(name, value) = a;
                value.Should().Be(e.Value);
                name.Should().Be(e.Name);
            }
        }
Ejemplo n.º 5
0
        public void GetMembers()
        {
            var expect = new[]
            {
                new Member <TEnum>(nameof(TEnum.MinValue)),
                new Member <TEnum>(nameof(TEnum.MaxValue)),
            };
            var actual = FastEnum.GetMembers <TEnum>();

            actual.Count.Should().Be(expect.Length);
            for (var i = 0; i < expect.Length; i++)
            {
                var a = actual[i];
                var e = expect[i];
                a.Value.Should().Be(e.Value);
                a.Name.Should().Be(e.Name);
                a.FieldInfo.Should().Be(e.FieldInfo);
            }
        }
Ejemplo n.º 6
0
 public void GetMembers()
 => FastEnum.GetMembers <TEnum>().Should().BeEmpty();