public void Test_SavesToDatabase() { Beanie testBeanie = new Beanie("Ryan", "High", 100, 1); testBeanie.Save(); List <Beanie> result = Beanie.GetAll(); List <Beanie> testList = new List <Beanie> { testBeanie }; Assert.Equal(testList, result); }
public HomeModule() { Get["/"] = _ => { return(View["index.cshtml"]); }; Post["/mybeaniebuddies"] = _ => { string name = Request.Form["beanie-name"]; string rarity = Request.Form["beanie-rarity"]; int cost = int.Parse(Request.Form["beanie-cost"]); Beanie userBeanie = new Beanie(name, rarity, cost); userBeanie.Save(); List <Beanie> allMyBabies = Beanie.GetAll(); return(View["beanies.cshtml", allMyBabies]); }; Post["/mycards"] = _ => { string name = Request.Form["card-name"]; string rarity = Request.Form["card-rarity"]; int cost = int.Parse(Request.Form["card-cost"]); Card userCard = new Card(name, rarity, cost); userCard.Save(); List <Card> allMyBabies = Card.GetAll(); return(View["cards.cshtml", allMyBabies]); }; Get["/throwOutBaby/{id}"] = parameters => { Beanie newBeanie = Beanie.Find(parameters.id); string name = newBeanie.GetName(); Beanie.RemoveABeanie(parameters.id); return(View["throwOutBaby.cshtml", name]); }; Get["/throwOutCard/{id}"] = parameters => { Card newCard = Card.Find(parameters.id); string name = newCard.GetName(); Card.RemoveACard(parameters.id); return(View["throwOutBaby.cshtml", name]); }; }
public void Test_DatabaseEmptyAtFirst() { int result = Beanie.GetAll().Count; Assert.Equal(0, result); }