public static ProfileHistoryItemViewModel Initialize(this ProfileHistoryItemViewModel model, ProfileHistoryItem historyItem, ITimestampFormatter timestampFormatter)
        {
            model.Text      = historyItem.Text;
            model.Timestamp = timestampFormatter.Format(historyItem.Timestamp);

            if (historyItem.Anime != null)
            {
                model.TitleInfo = new TitlePreviewPartialViewModel
                {
                    ControllerName = "Anime",
                    Title          = new TitlePreviewViewModel().Initialize(historyItem.Anime)
                }
            }
            ;
            if (historyItem.Manga != null)
            {
                model.TitleInfo = new TitlePreviewPartialViewModel
                {
                    ControllerName = "Manga",
                    Title          = new TitlePreviewViewModel().Initialize(historyItem.Manga)
                }
            }
            ;
            if (historyItem.UserList != null)
            {
                model.UserList = new UserListInfoViewModel().Initialize(historyItem.UserList);
            }

            return(model);
        }
    }
}
        public void TitleIsNull()
        {
            var historyItem = new ProfileHistoryItem();

            var result = new ProfileHistoryItemViewModel().Initialize(historyItem, GetTimestampFormatter());

            Assert.Null(result.TitleInfo);
        }
        public void HasMangaTitle()
        {
            var historyItem = new ProfileHistoryItem
            {
                Manga = new Manga()
            };

            var result = new ProfileHistoryItemViewModel().Initialize(historyItem, GetTimestampFormatter());

            Assert.NotNull(result.TitleInfo);
        }
        public void HasMangaTitleAndUserList()
        {
            var historyItem = new ProfileHistoryItem
            {
                Anime    = new Anime(),
                UserList = new UserAnimeList()
            };

            var result = new ProfileHistoryItemViewModel().Initialize(historyItem, GetTimestampFormatter());

            Assert.NotNull(result.TitleInfo);
            Assert.NotNull(result.UserList);
        }