示例#1
0
        public void DeleteVoteTest()
        {
            var              testVote         = VoteFactory.AnotherVote();
            RestResponse     restVoteResponse = Execute(PostVoteRequest(testVote));
            VotePostResponse votePostResponse = Deserialize <VotePostResponse>(restVoteResponse.Content);

            RestResponse restVoteDeleteResponse        = Execute(DeleteVoteRequest(votePostResponse.Id));
            Dictionary <string, string> deleteResponse = Deserialize <Dictionary <string, string> >(restVoteDeleteResponse.Content);

            using (new AssertionScope())
            {
                restVoteDeleteResponse.StatusCode.Should().Be(HttpStatusCode.OK);
                deleteResponse[messageField].Should().Be(successMessage);
            }
        }
示例#2
0
        public void DeleteVote2TimesTest()
        {
            var              testVote         = VoteFactory.AnotherVote();
            RestResponse     restVoteResponse = Execute(PostVoteRequest(testVote));
            VotePostResponse votePostResponse = Deserialize <VotePostResponse>(restVoteResponse.Content);

            Execute(DeleteVoteRequest(votePostResponse.Id));
            RestResponse restVoteDeleteResponse        = Execute(DeleteVoteRequest(votePostResponse.Id));
            Dictionary <string, object> deleteResponse = Deserialize <Dictionary <string, object> >(restVoteDeleteResponse.Content);

            using (new AssertionScope())
            {
                restVoteDeleteResponse.StatusCode.Should().Be(HttpStatusCode.BadRequest);
                deleteResponse[messageField].ToString().Should().Be(invalidAccountMessage);
            }
        }
示例#3
0
        public void GetVoteTest()
        {
            var              testVote         = VoteFactory.AnotherVote();
            RestResponse     restVoteResponse = Execute(PostVoteRequest(testVote));
            VotePostResponse votePostResponse = Deserialize <VotePostResponse>(restVoteResponse.Content);

            RestResponse    restVoteGetResponse = Execute(GetVoteRequest(votePostResponse.Id));
            VoteGetResponse voteGetResponse     = Deserialize <VoteGetResponse>(restVoteGetResponse.Content);

            using (new AssertionScope())
            {
                restVoteResponse.StatusCode.Should().Be(HttpStatusCode.OK);
                voteGetResponse.Id.Should().Be(votePostResponse.Id);
                voteGetResponse.Image_id.Should().Be(testVote.Image_id);
                voteGetResponse.Sub_id.Should().Be(testVote.Sub_id);
                voteGetResponse.Value.Should().Be(testVote.Value);
            }
        }