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 void TestNegativeSCPSubmission() { var userName = "******"; //Create user VoatDataInitializer.CreateUser(userName, DateTime.UtcNow.AddDays(-450)); //Add submission with negatives directly to db using (var context = new voatEntities()) { var s = context.Submissions.Add(new Submission() { CreationDate = DateTime.UtcNow.AddHours(-12), Subverse = "unit", Title = "Test Negative SCP", Url = "https://www.youtube.com/watch?v=pnbJEg9r1o8", Type = 2, UpCount = 2, DownCount = 13, UserName = userName }); context.SaveChanges(); } TestHelper.SetPrincipal(userName); var userSubmission = new Domain.Models.UserSubmission() { Subverse = "unit", Title = "Le Censorship!", Content = "Will this work?" }; var cmd = new CreateSubmissionCommand(userSubmission); var r = cmd.Execute().Result; Assert.IsNotNull(r, "Response was null"); Assert.IsTrue(r.Success, r.Message); }
public static void ClassInitialize(TestContext context) { VoatDataInitializer.CreateSorted(subverse); }
public static void ClassInitialize(TestContext context) { _submissionID = VoatDataInitializer.BuildCommentTree("anon", "Build Comment Tree", 1, 2, 2); }
public static void ClassInitialize(TestContext context) { _unitSubmissionID = VoatDataInitializer.BuildCommentTree("unit", "Build Comment Tree", _rootCount, _nestedCount, _recurseCount); }