public void GetAllRecords() { List<BookDto> bookDtos = Reader.GetRecords<BookDto>().ToList(); foreach (var bookDto in bookDtos) { Book book = new Book(); Mapper.Map(bookDto, book); Books.Add(book); } }
public void Test_MapToViewModel_Profile_TestMapping_Field() { Mapper.Initialize(m => m.AddProfile(new MapToViewModelProfile())); Book bookModel = new Book { Name = "Book1", Minutes = 320 }; Models.ViewModels.Book bookViewModel = new Models.ViewModels.Book(); Mapper.Map(bookModel, bookViewModel); Assert.AreEqual(bookModel.Name, bookViewModel.Name); Assert.AreEqual("Book1", bookViewModel.Name); Assert.AreEqual("5h 20m", bookViewModel.RunningTime); }