Exemple #1
0
 public void CreateTeam()
 {
     var teamService = new TeamService(_mockTeamRepository);
     var teamDto = new TeamDto();
     teamDto.Name = "team 1";
     var team =  teamService.Create(teamDto);
     Assert.That(team.TeamId, !Is.Null);
     Assert.That(team.Name, Is.EqualTo("team 1"));
 }
Exemple #2
0
        public void UpdateTeam()
        {
            //arrange
            var teamService = new TeamService(_mockTeamRepository);
            var stubTeam = new Team(){TeamId = 1, Name = "team 1"};

            //act
            teamService.UpdateTeam(stubTeam);

            //assert
            _mockTeamRepository.Received().UpdateTeam(stubTeam);
        }
Exemple #3
0
        public void RetrieveTeam()
        {
            //arrange
            var teamService = new TeamService(_mockTeamRepository);
            var stubTeam = new Team(){TeamId = 1, Name = "team 1"};
            _mockTeamRepository.RetrieveTeam(stubTeam.TeamId).Returns(stubTeam);

            //act
            var teamToReturn = teamService.GetTeam(stubTeam.TeamId);
            //assert
            Assert.That(teamToReturn.Name, Is.EqualTo("team 1"));
        }
        public void SetUpFixture()
        {
            _mockTeamRepository = Substitute.For<ITeamRepository>();

            _mockTeamRepository.GetTeams().Returns(new List<Team>
            {
                new Team {TeamId = 1, Name = "Team1"},
                new Team {TeamId = 2, Name = "Team3"},
                new Team {TeamId = 3, Name = "Team4"},
                new Team {TeamId = 4, Name = "Team2"}
            });
             _teamService = new TeamService(_mockTeamRepository);
        }