Esempio n. 1
0
        public void UpdateTeamModifiesTeamToList()
        {
            TeamsController controller = new TeamsController(new TestMemoryTeamRepository());
            var             teams      = (IEnumerable <Team>)(controller.GetAllTeams() as ObjectResult).Value;
            List <Team>     original   = new List <Team>(teams);

            Guid id     = Guid.NewGuid();
            Team t      = new Team("sample", id);
            var  result = controller.CreateTeam(t);

            Team newTeam = new Team("sample2", id);

            controller.UpdateTeam(newTeam, id);

            var         newTeamsRaw = (IEnumerable <Team>)(controller.GetAllTeams() as ObjectResult).Value;
            List <Team> newTeams    = new List <Team>(newTeamsRaw);
            var         sampleTeam  = newTeams.FirstOrDefault(target => target.Name == "sample");

            Assert.Null(sampleTeam);

            Team retrievedTeam = (Team)(controller.GetTeam(id) as ObjectResult).Value;

            Assert.Equal("sample2", retrievedTeam.Name);
        }