예제 #1
0
        public void GetById_ClubExist_ReturnClub()
        {
            var club = ModelSetup.SetupClubWithNoPeople();

            var result = GetResult <Club>("/api/club/" + club.Id);

            result.Id.ShouldBe(club.Id);
        }
예제 #2
0
        public void GetById_ClubExist_ReturnOk()
        {
            var club = ModelSetup.SetupClubWithNoPeople();

            var response = GetResponse("/api/club/" + club.Id);

            response.StatusCode.ShouldBe(HttpStatusCode.OK);
        }
예제 #3
0
        public void GetPeople_ClubExistNoPeople_ReturnsList()
        {
            var club = ModelSetup.SetupClubWithNoPeople();

            var result = GetResult <Person>("/api/club/" + club.Id + "/people");

            result.ShouldBeNull();
        }
예제 #4
0
        public void Update_ValidUpdate_Return200()
        {
            var club = ModelSetup.SetupClubWithNoPeople();

            var response = PutResponse("/api/club", club);

            response.StatusCode.ShouldBe(HttpStatusCode.OK);
        }
예제 #5
0
        public void Update_IdNotFound_Return204()
        {
            var club = ModelSetup.SetupClubWithNoPeople();

            club.Id = 1;

            var response = PutResponse("/api/club", club);

            response.StatusCode.ShouldBe(HttpStatusCode.NoContent);
        }
예제 #6
0
        public void Update_InvalidModel_Return400()
        {
            var club = ModelSetup.SetupClubWithNoPeople();

            club.NafaClubNumber = -1;

            var response = PutResponse("/api/club", club);

            response.StatusCode.ShouldBe(HttpStatusCode.BadRequest);
        }
예제 #7
0
        public void Update_ValidUpdate_ReturnUpdateModel()
        {
            string newName = "Updated";

            var club = ModelSetup.SetupClubWithNoPeople();

            club.Name = newName;

            var result = PutResult <Club>("/api/club", club);

            result.Name.ShouldBe(newName);
        }
예제 #8
0
        public static void PopulateTestData(FlyballDbContext context)
        {
            Sheridan.Flyball.Data.EFCore.SeedData.PopulateData(context);
            context.Clubs.Add(ModelSetup.SetupClubWithPeople());
            context.Clubs.Add(ModelSetup.SetupClubWithNoPeople());

            var tournament = ModelSetup.KingsTournament;

            tournament.AddDivision(ModelSetup.Open1);
            tournament.AddDivision(ModelSetup.Open2);
            tournament.AddDivision(ModelSetup.Regular1);
            tournament.AddDivision(ModelSetup.Regular2);
            tournament.AddRaceYear(ModelSetup.CurrentRaceYear);

            tournament.AddRace(ModelSetup.Race1LeftSide);
            tournament.AddRace(ModelSetup.Race1RightSide);



            context.SaveChanges();
        }