public async Task UserData_Information_SubscriptionTests() { //ensure users with no subscriptions don't error out var noSubUserName = "******"; VoatDataInitializer.CreateUser(noSubUserName); var userData = new Domain.UserData(noSubUserName); //var userData = new Domain.UserData(noSubUserName); Assert.AreEqual(0, userData.SubverseSubscriptions.Count()); Assert.AreEqual(false, userData.HasSubscriptions()); Assert.AreEqual(false, userData.HasSubscriptions(DomainType.Subverse)); //test subscription var subUserName = "******"; VoatDataInitializer.CreateUser(subUserName); TestHelper.SetPrincipal(subUserName); var cmd = new SubscriptionCommand(Domain.Models.DomainType.Subverse, Domain.Models.SubscriptionAction.Subscribe, "unit"); var x = await cmd.Execute(); userData = new Domain.UserData(subUserName); Assert.AreEqual(1, userData.SubverseSubscriptions.Count()); Assert.AreEqual("unit", userData.SubverseSubscriptions.First()); Assert.AreEqual(true, userData.HasSubscriptions()); Assert.AreEqual(true, userData.HasSubscriptions(DomainType.Subverse)); Assert.AreEqual(true, userData.IsUserSubverseSubscriber("unit")); }
public IActionResult Param() { // Receive parameters from index.cshtml. string firstName = String.Format(Request.Form["firstName"].ToString()); string lastName = String.Format(Request.Form["lastName"].ToString()); string mobileNum = String.Format(Request.Form["mobileNumber"].ToString()); SubscriptionCommand command = new SubscriptionCommand(); ViewBag.Message = command.Execute(firstName, lastName, mobileNum); return(View()); }