public void TestCollectFromParentWithInvalidInputThrowsException() { var parentList = CollectionsMockBuilder.GetValidParentList(); parentList.Add(new Parent()); Assert.Throws <InvalidCastException>(() => CollectionUtils.CollectFromParent <Parent, Child>(parentList)); }
public void TestCollectFromParentWithNullInputThrowsException() { var parentList = CollectionsMockBuilder.GetValidParentList(); parentList.Add(new Parent()); Assert.Throws <NullReferenceException>(() => CollectionUtils.CollectFromParent <Parent, Child>(null)); }
public void TestCollectFromParentSuccess() { var parentList = CollectionsMockBuilder.GetValidParentList(); var actual = CollectionUtils.CollectFromParent <Parent, Child>(parentList); Assert.IsTrue(actual.Any(i => i.ParentName.Equals("Parent1"))); }
public void TestCollectFromChildWithNullInputThrowsException() { Assert.Throws <NullReferenceException>(() => CollectionUtils.CollectFromParent <Parent, Child>(null)); }