public void ShouldRetrunDestinationVmForEdit() { var destination = new Destination() { Id = 1, CountryId = 1, Name = "test", CreatedDateTime = DateTime.Now }; var countries = new List <Country>() { new Country() { Id = 1, Name = "test", SubsistanceAllowenceId = 1 } }; var config = new MapperConfiguration(cfg => { cfg.AddProfile(new MappingProfile()); }); var mapper = config.CreateMapper(); var destRepo = new Mock <IDestinationRepository>(); destRepo.Setup(d => d.GetDestinationById(1)).Returns(destination); destRepo.Setup(d => d.GetAllCountries()).Returns(countries.AsQueryable()); var destServ = new DestinationService(destRepo.Object, mapper); var destVmForEdit = destServ.GetDestinationForEdit(1); destVmForEdit.Should().BeOfType(typeof(NewDestinationVm)); destVmForEdit.Should().NotBeNull(); destVmForEdit.Countries.Should().AllBeOfType(typeof(CountryVm)); destVmForEdit.Countries.Should().HaveCount(1); }