public void ShouldGetByName() { var leagueRepoMock = new Mock <ILeagueRepository>(); leagueRepoMock.Setup(p => p.GetByName("NHL")).Returns( new League() { Name = "NHL", FirstYear = 1, LastYear = null, Id = 1, CompetitionConfigs = new List <CompetitionConfig>() { new SeasonCompetitionConfig() { Id = 5 }, new PlayoffCompetitionConfig() { Id = 15 } } } ); var leagueService = new LeagueService(leagueRepoMock.Object); var league = leagueService.GetByName("NHL"); True(league is LeagueViewModel); Equals("NHL", league.Name); StrictEqual(1, league.Id); StrictEqual(1, league.FirstYear); Null(league.LastYear); }