public void MeetupUrlParserOnlyAcceptsEventAddresses() { var url = "https://www.meetup.com/dotnetoxford/foo/249057796/"; (string group, string eventId) = MeetupUrlParser.Parse(url); group.ShouldBeNullOrEmpty(); eventId.ShouldBeNullOrEmpty(); }
public void MeetupUrlParserOnlyAcceptsMeetupDomain() { var url = "https://www.foo.com/Milton-Keynes-NET-Meetup-Group/events/250807726/"; (string group, string eventId) = MeetupUrlParser.Parse(url); group.ShouldBeNullOrEmpty(); eventId.ShouldBeNullOrEmpty(); }
public IActionResult Index(string meetupUrl) { meetupUrl = (meetupUrl ?? "").Trim(); // handle null input, trim any spaces that were accidentally copied :-) (string groupId, string eventId) = MeetupUrlParser.Parse(meetupUrl); if (groupId == null || eventId == null) { TempData["Message"] = "Couldn't parse URL :-("; return(View()); } else { return(RedirectToRoute("PrizeDraw", new { groupId, eventId })); } }
public void MeetupUrlParserTheory(string url, string expectedGroup, string expectedEventId) { (string group, string eventId) = MeetupUrlParser.Parse(url); group.ShouldBe(expectedGroup); eventId.ShouldBe(expectedEventId); }