public async Task Should_Return_Error_When_Not_Logged() { var getMyVotes = new GetMyVotes(); var getMyVotesResponse = await Mediator.Send(getMyVotes); AssertError <AuthorizationError> .Of(getMyVotesResponse); }
public async Task Should_Return_Error_On_Twice_Vote_On_Same_Question() { await LogInAsAdministrator(); var createQuestion = new CreateQuestion( questionText: "Some question?", answers: new[] { "First answer", "Second answer" }); var createQuestionResponse = await Mediator.Send(createQuestion); var createdQuestionId = AssertNotError.Of(createQuestionResponse); var getQuestion = new GetQuestion(createdQuestionId); var questionResponse = await Mediator.Send(getQuestion); var createdQuestion = AssertNotError.Of(questionResponse); await LogInAsVoter(); var voteFor = new VoteFor( questionId: createdQuestion.Id, answerId: createdQuestion.Answers[1].Id); var voteForResponse = await Mediator.Send(voteFor); var voteForDuplicate = new VoteFor( questionId: createdQuestion.Id, answerId: createdQuestion.Answers[0].Id); var voteForResponseDuplicate = await Mediator.Send(voteForDuplicate); AssertError <DomainError> .Of(voteForResponseDuplicate); }
public async Task Should_Return_Error_When_Not_Logged() { await LogInAsAdministrator(); var createQuestion = new CreateQuestion( questionText: "Some question?", answers: new[] { "First answer", "Second answer" }); var createQuestionResponse = await Mediator.Send(createQuestion); var createdQuestionId = AssertNotError.Of(createQuestionResponse); var getQuestion = new GetQuestion(createdQuestionId); var questionResponse = await Mediator.Send(getQuestion); var createdQuestion = AssertNotError.Of(questionResponse); LogOut(); var voteFor = new VoteFor( questionId: createdQuestion.Id, answerId: createdQuestion.Answers[1].Id); var voteForResponse = await Mediator.Send(voteFor); AssertError <AuthorizationError> .Of(voteForResponse); }
public async Task Should_Return_Error_On_Not_Logged_In() { var createQuestion = new CreateQuestion( questionText: "Some question?", answers: new[] { "First answer", "Second answer" }); var createQuestionResponse = await Mediator.Send(createQuestion); AssertError <AuthorizationError> .Of(createQuestionResponse); }
public async Task Should_Return_Error_On_Duplicated_Voter() { const string voterPesel = "87062537594"; var createFirstVoter = new CreateVoter(voterPesel); var firstResponse = await Mediator.Send(createFirstVoter); var createSameAsPreviousVoter = new CreateVoter(voterPesel); var secondResponse = await Mediator.Send(createSameAsPreviousVoter); AssertNotError.Of(firstResponse); AssertError <ObjectAlreadyExistsError> .Of(secondResponse); }
public async Task Should_Return_Error_When_Request_For_Result_Of_Not_Voted_Question() { await LogInAsAdministrator(); var createQuestion = new CreateQuestion( questionText: "Some question?", answers: new[] { "First answer", "Second answer" }); var createQuestionResponse = await Mediator.Send(createQuestion); var questionId = AssertNotError.Of(createQuestionResponse); await LogInAsVoter(); var getResult = new GetQuestionResult(questionId); var getResultResponse = await Mediator.Send(getResult); AssertError <AuthorizationError> .Of(getResultResponse); }