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); }
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 Constructor_WhenSourceIsNull_ThrownArgumentNullException() { try { var extractor = new EnumerableFieldDescriptionsExtractor(null); Assert.Fail("ArgumentNullException expected"); } catch (ArgumentNullException) { } }