public void GetDescriptions_WhenNoSpecialInterfacesAreImplemented_WhenEnumerableIsGeneric_RetrievesDescriptionsFromTheTypeOfTheGenericArgument()
        {
            var items                = EnumerableScenariosHelper.GetGenericEnumerableOfBaseTypeWithItemsThatInheritFromBaseType();
            var extractor            = new EnumerableFieldDescriptionsExtractor(items);
            var expectedProperyNames = new[] { "NormalPropertyOne", "NormalPropertyTwo" };

            var descriptions        = extractor.GetDescriptions();
            var actualPropertyNames = descriptions.Select(fd => fd.Name).ToList();

            CollectionAssert.AreEqual(expectedProperyNames, actualPropertyNames);
        }
        public void GetDescriptions_WhenNoSpecialInterfacesAreImplemented_WhenEmptyEnumerableIsPassed_WhenEnumerableIsNotGeneric_RetrievesNoDescriptions()
        {
            var items                = EnumerableScenariosHelper.GetNonGenericEmptyEnumerable();
            var extractor            = new EnumerableFieldDescriptionsExtractor(items);
            var expectedProperyNames = new string[] { };

            var descriptions        = extractor.GetDescriptions();
            var actualPropertyNames = descriptions.Select(fd => fd.Name).ToList();

            CollectionAssert.AreEqual(expectedProperyNames, actualPropertyNames);
        }
示例#3
0
        public void GenerateDescriptionsData_WhenItemsSourceOfTheDataProviderIsEnumerable_WhenNoSpecialInterfacesAreImplemented_WhenEnumerableIsGenericAndGenericTypeIsObject_ReturnsDescriptionsDataWithFieldInfoNodesForEveryPublicPropertyOfTheFirstItemType()
        {
            var items = EnumerableScenariosHelper.GetGenericEnumerableOfObjectWithItemsOfBaseType();

            this.dataProvider.ItemsSource = items;
            var expectedFieldInfoNames = new[] { "NormalPropertyOne", "NormalPropertyTwo" };

            var infoData             = this.provider.ExposedGenerateDescriptionsData();
            var actualFieldInfoNames = infoData.RootFieldInfo.Children.OfType <FieldInfoNode>().Select(fd => fd.FieldInfo.Name).ToList();

            CollectionAssert.AreEqual(expectedFieldInfoNames, actualFieldInfoNames);
        }
示例#4
0
        public void GenerateDescriptionsData_WhenItemsSourceOfTheDataProviderIsEmptyEnumerable_WhenNoSpecialInterfacesAreImplemented_WhenEnumerableIsNotGeneric_ReturnsDescriptionsDataWithNoFieldInfoNodes()
        {
            var items = EnumerableScenariosHelper.GetNonGenericEmptyEnumerable();

            this.dataProvider.ItemsSource = items;
            var expectedFieldInfoNames = new string[] { };

            var infoData             = this.provider.ExposedGenerateDescriptionsData();
            var actualFieldInfoNames = infoData.RootFieldInfo.Children.OfType <FieldInfoNode>().Select(fd => fd.FieldInfo.Name).ToList();

            CollectionAssert.AreEqual(expectedFieldInfoNames, actualFieldInfoNames);
        }