Inheritance: Controller
Beispiel #1
0
        public void We_Should_Be_Able_To_Update_A_Club()
        {
            ViewResult result = null;
            string newName = "NewClubname";

            Given("we have a club and a controller", () =>
            {
                controller = new ClubController();
            });

            When("we want to update the club", () =>
            {
                club.Name = newName;
                controller.Edit(club);
            });

            Then("the club's name should be updated", () =>
            {
                using (var context = new Entities())
                {
                    var clubDb = context.Clubs.Single(clb => clb.ClubID == club.Id);
                    clubDb.Name.ShouldBe(newName);
                }
            });
        }
Beispiel #2
0
        public void We_Should_Get_A_ClubModel_When_Editing()
        {
            ViewResult result = null;

            Given("we have a club and a controller", () =>
            {
                controller = new ClubController();
            });

            When("we want to edit a club", () =>
            {
                result = (ViewResult)controller.Edit(club.Id);
            });

            Then("we should get a club", () =>
            {
                result.Model.ShouldBeInstanceOfType<ClubModel>();
            });
        }
Beispiel #3
0
        public void We_Should_Get_A_List_Of_Clubs_When_Going_To_Index()
        {
            ViewResult result = null;

            Given("we have a controller", () =>
            {
                controller = new ClubController();
            });

            When("we want to go to index page", () =>
            {
                result = (ViewResult)controller.Index();
            });

            Then("view should show a list of clubs", () =>
            {
                result.Model.ShouldBeInstanceOfType<List<ClubModel>>();
            });
        }