Exemple #1
0
        public void ReturnJsonArrayWithTheEditedPlayer_WhenPassedModelParamIsNotNull()
        {
            // arrange
            var playerService   = new Mock <IPlayerService>();
            var playerVieWModel = new GridPlayerViewModel()
            {
                FirstName = "someName"
            };

            var mapService = new Mock <IMappingService>();

            var leagueDataModel = new Player()
            {
                FirstName = "someName"
            };

            mapService.Setup(c => c.Map <Player>(It.IsAny <Object>()))
            .Returns(leagueDataModel);

            MappingService.MappingProvider = mapService.Object;
            var controller = new PlayersGridController(playerService.Object);

            // act
            controller.EditPlayer(playerVieWModel);

            // assert
            controller.WithCallTo(c => c.EditPlayer(playerVieWModel))
            .ShouldReturnJson((data) => Assert.AreSame(data[0], playerVieWModel));
        }
Exemple #2
0
        public void RenderDefaultView_WhenInvoked()
        {
            // arrange
            var playerService = new Mock <IPlayerService>();
            var controller    = new PlayersGridController(playerService.Object);

            // act & assert
            controller.WithCallTo(c => c.Index())
            .ShouldRenderDefaultView();
        }
Exemple #3
0
        public void ReturnJsonArrayWithDeletedTeam_WhenPassedModelParamIsNotNull()
        {
            // arrange
            var teamService     = new Mock <IPlayerService>();
            var playerViewModel = new GridPlayerViewModel()
            {
                FirstName = "someName"
            };
            var controller = new PlayersGridController(teamService.Object);

            // act
            controller.DeletePlayer(playerViewModel);

            // assert
            controller.WithCallTo(c => c.DeletePlayer(playerViewModel))
            .ShouldReturnJson((data) => Assert.AreSame(data[0], playerViewModel));
        }