public void GetFieldListTest() { // Arrange. var dto1 = new DisplayListSortFieldEditDto(); var field1 = CreateSortField(dto1); var dto2 = new DisplayListSortFieldEditDto(); var field2 = CreateSortField(dto2); var dto3 = new DisplayListSortFieldEditDto(); var field3 = CreateSortField(dto3); // Act. var list = DisplayListSortFieldList.GetFieldList(new[] { dto1, dto2, dto3 }); // Assert. Assert.IsNotNull(list); Assert.AreEqual(3, list.Count); Assert.IsTrue(list.Contains(field1)); Assert.IsTrue(list.Contains(field2)); Assert.IsTrue(list.Contains(field3)); // Argument Validation. TestsHelper.VerifyThrow<ArgumentNullException>(() => DisplayListSortFieldList.GetFieldList(null)); }
private DisplayListSortFieldEdit CreateSortField(DisplayListSortFieldEditDto dto) { var sortField = Mock.Create<DisplayListSortFieldEdit>(Behavior.Loose); Mock.Arrange(() => sortField.IsChild).Returns(true); Mock.Arrange(() => DisplayListSortFieldEdit.GetField(dto)).Returns(sortField); return sortField; }