public void Test_MakePost1ArgInValid() { Controller.ModelState.AddModelError("key", "Error."); WebSecurity.Setup(w => w.CurrentUserId()).Returns(0); Post APost = new Post { UserID = 988 }; Location ALocation = new Location { LocationID = 988 }; PostLocationModel APlm = new PostLocationModel(); APlm.Tpost = APost; APlm.Tlocation = ALocation; var result = Controller._MakePost(APlm) as PartialViewResult; Assert.IsNotNull(result); Assert.IsNotNull(result.ViewBag.GroupList); foreach (Group g in result.ViewBag.TestingGroupList) { if (g.IsPrivate == true) { //If a private group make sure they are an owner. Assert.IsTrue(db.user0.Groups.Contains(g)); } //Private group not an owner of. Assert.IsFalse(g.GroupID == 3); } Assert.AreEqual("_MakePost", result.ViewName); }
public void Test_MakePost1ArgValid() { WebSecurity.Setup(w => w.CurrentUserId()).Returns(0); Post APost = new Post { UserID = 988 }; Location ALocation = new Location { LocationID = 988 }; PostLocationModel APlm = new PostLocationModel(); APlm.Tpost = APost; APlm.Tlocation = ALocation; var result = Controller._MakePost(APlm) as JavaScriptResult; Assert.IsNotNull(result); Assert.IsTrue(SocialContext.Posts.Contains(APost)); Assert.IsTrue(SocialContext.Locations.Contains(ALocation)); Assert.AreEqual(result.Script, "$('#postcontainer').hide(); removeRadiusSelctor();" + "updateMarkers();"); }
//Groups //Set up the locations. private void SetUpLocations() { location0 = new Location { LocationID = 0, Latitude = (Decimal)49.246458, Longitude = (Decimal)(-123.09391) }; location1 = new Location { LocationID = 1, Latitude = (Decimal)49.243036, Longitude = (Decimal)(-123.088074) }; location2 = new Location { LocationID = 2, Latitude = (Decimal)49.241078, Longitude = (Decimal)(-122.923622) }; }