public void Test_GetbyID_Return_OkResult() { //Arrange var controller = new StadiumController(stadiumService); //Act var data = controller.Get(1); //Assert Assert.IsType <OkObjectResult>(data); }
public void Test_Delete_Return_OkResult() { //Arrange var controller = new StadiumController(stadiumService); var request = 1; //Act var data = controller.Delete(request); //Assert Assert.IsType <OkObjectResult>(data); }
public void Initialize() { this.service = new Mock <ILeagueService>(); this.controller = new StadiumController(service.Object); this.request = new HttpRequestMessage(); request.SetConfiguration(new System.Web.Http.HttpConfiguration()); Mapper.Initialize(x => { x.AddProfile <DomainToViewModelMappingProfile>(); }); }
public void Test_Put_Return_OkResult() { //Arrange var controller = new StadiumController(stadiumService); var request = new StadiumModel { StadiumID = 1, StadiumName = "capetown" };; //Act var data = controller.Put(1, request); //Assert Assert.IsType <OkResult>(data); }
public void Test_Post_Return_OkResult() { //Arrange var controller = new StadiumController(stadiumService); var request = new StadiumModel { StadiumID = 1, StadiumName = "Centurion" }; //Act var data = controller.Post(request); //Assert Assert.IsType <OkObjectResult>(data); }
public UnitTestStadiumController() { var options = new DbContextOptionsBuilder <FootballApiContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; context = new FootballApiContext(options); context.Stadium.Add(new Stadium { Name = "Stade Santiago-Bernabéu", NumberOfPlaces = 81044, FootballTeamID = 1 }); context.Stadium.Add(new Stadium { Name = "Allianz Arena", NumberOfPlaces = 75024, FootballTeamID = 16 }); context.Stadium.Add(new Stadium { Name = "Juventus Stadium", NumberOfPlaces = 41507, FootballTeamID = 111 }); context.SaveChanges(); stadiumController = new StadiumController(context); }