public void Test_DeletePlayerByIdReturnNotFound()
        {
            // Arrange
            TennisPlayerController controller = new TennisPlayerController(repo);
            // Act
            IHttpActionResult actionResult = controller.Delete(notExistPlayerId);

            //Assert
            Assert.IsInstanceOfType(actionResult, typeof(NotFoundResult));
        }
Пример #2
0
        public async Task DeletePlayerShouldReturnOk()
        {
            //Arrange
            Mock <IDeletePlayerUsesCase> moqDeletePlayerUsesCase = new Mock <IDeletePlayerUsesCase>();
            var player = new Player(2, "name2", "surname2", "M", It.IsAny <Country>(), "", It.IsAny <Data>());

            moqDeletePlayerUsesCase.Setup(m => m.Handle(It.IsAny <DeletePlayerCommand>())).Verifiable();
            var sut = new TennisPlayerController(It.IsAny <IGetPlayersUsesCase>(), It.IsAny <IGetPlayerUsesCase>(), moqDeletePlayerUsesCase.Object);

            //Act
            var result = await sut.Delete(player.Id);

            //Assert
            Assert.NotNull(result);
            Assert.IsType <OkResult>(result);
        }