コード例 #1
0
        public void Test_Add_Same_Type_Multiple_Times()
        {
            var distinctTypes = new DistinctTypeList();

            distinctTypes.Add(typeof(DistinctTypeList));
            distinctTypes.Add(typeof(DistinctTypeList));

            distinctTypes.GetAllTypes().Count().Should().Be(1);
        }
コード例 #2
0
        public void Validate_DistinctTypeList()
        {
            var distinctTypeList = new DistinctTypeList();

            distinctTypeList.Add(typeof(TestClassWithoutAttributes.ClassA));
            distinctTypeList.Add(typeof(TestClassWithoutAttributes.ClassB));

            var results = _attributeChecker.CheckPropertiesForAttributes(distinctTypeList, _attributes);

            results.Count.Should().Be(distinctTypeList.GetAllTypes().Sum(s => s.GetProperties().Length));
        }
コード例 #3
0
        public void AddRange_Should_Contain_Types_Of_Both_Lists()
        {
            var typeList1 = new[] { typeof(TestClassWithAttributes), typeof(TestClassWithAttributes.ClassA) };
            var typeList2 = new[] { typeof(TestClassWithoutAttributes), typeof(TestClassWithoutAttributes.ClassA) };

            var distinctList1 = new DistinctTypeList();
            var distinctList2 = new DistinctTypeList();

            distinctList1.AddRange(typeList1);
            distinctList2.AddRange(typeList2);

            distinctList1.AddRange(distinctList2);

            distinctList1.GetAllTypes().Count().Should().Be(typeList1.Length + typeList2.Length);
        }