Example #1
0
        public PlayerDetailsViewModel RetrievePlayer(int id)
        {
            var playerProcessor = new PlayerProcessor();
            var player          = new PlayerDetailsViewModel();

            player.player      = new Person();
            player.contract    = new Contract();
            player.healthCheck = new HealthCheckEvidention();

            try
            {
                var myPlayer = playerProcessor.RetrievePlayerDetails(id);
                player.player = playerProcessor.RetrievePlayer(myPlayer.Id);
                if (myPlayer.ContractId != 0 && myPlayer.ContractId != null)
                {
                    player.contract = playerProcessor.RetrieveContract(myPlayer.ContractId);
                }
                if (myPlayer.HealthCheckId != 0 && myPlayer.HealthCheckId != null)
                {
                    player.healthCheck = playerProcessor.RetrieveHealthCheck(myPlayer.HealthCheckId);
                }
            }

            catch (Exception e)
            {
                player = null;
            }

            return(player);
        }
Example #2
0
        public void Validate_RetrieveHealthCheck()
        {
            int id = 1;
            HealthCheckEvidention health = new HealthCheckEvidention();

            var repository = new Mock <IPlayerRepository>();

            repository.Setup(x => x.GetHealthCheck(id)).Returns(health);

            PlayerProcessor processor = new PlayerProcessor();

            processor.Repository = (IPlayerRepository)repository.Object;

            var res = processor.RetrieveHealthCheck(id);

            repository.Verify(x => x.GetHealthCheck(id), Times.Exactly(1));
        }