Ejemplo n.º 1
0
        public async Task a_guest_cannot_cast_a_vote()
        {
            var post = new Post {
                Title = "Example title", Body = "Example body", UserId = Context.Users.First().Id
            };

            Context.Posts.Add(post);
            Context.SaveChanges();

            var response = await Guest.GetAsync($"/questions/{post.Id}/vote/1");

            Assert.Equal($"/login?ReturnUrl=%2Fquestions%2F{post.Id}%2Fvote%2F1", TestUtilities.ResponseUrl(response));
        }
Ejemplo n.º 2
0
        public async Task a_guest_cannot_accept_a_anwser()
        {
            var post = new Post {
                Title = "Example title", Body = "Example body", UserId = 1
            };
            var anwser = new Post {
                Parent = post, Body = "Example anwser", UserId = 2
            };

            Context.Posts.Add(post);
            Context.Posts.Add(anwser);
            Context.SaveChanges();

            var response = await Guest.GetAsync($"/questions/{post.Id}/accept/{anwser.Id}");

            Assert.Equal($"/login?ReturnUrl=%2Fquestions%2F{post.Id}%2Faccept%2F{anwser.Id}", TestUtilities.ResponseUrl(response));
        }