public void Test_Load_Attachments_From_DataService() { var files = new List <IFileInfo> { ContentTestHelper.CreateValidFile(0), ContentTestHelper.CreateValidFile(1), ContentTestHelper.CreateValidFile(2) }; var dataService = DataServiceFactory(); dataService.Setup(ds => ds.GetContentItem(It.IsAny <int>())).Returns(MockHelper.CreateValidContentItemReader); dataService.Setup( ds => ds.GetMetaData(It.IsAny <int>())).Returns( () => MockHelper.CreateMetaDataReaderWithFiles(files, new IFileInfo[0], new IFileInfo[0])); var contentItem = Util.GetContentController().GetContentItem(Constants.CONTENT_ValidContentItemId); Assert.IsNotNull(contentItem); var serialized = contentItem.Metadata[FileController.FilesKey]; Assert.IsNotEmpty(serialized); Assert.IsNotEmpty(contentItem.Files); Assert.AreEqual(contentItem.Files.Count, 3); Assert.AreEqual(contentItem.Files[0].FileId, 0); Assert.AreEqual(contentItem.Files[1].FileId, 1); Assert.AreEqual(contentItem.Files[2].FileId, 2); }