public async void ProposalsFunctionalityTest() { _token = await _accountManagementService.SignIn(TestingObjectProvider.Instance.Login); Assert.NotNull(_token); var proposal = TestingObjectProvider.Instance.Proposal; var restServiceMock = new Mock <IRestService>(); restServiceMock.Setup(s => s.ExecuteGetAction <List <Proposal> >( It.IsAny <string>(), It.IsAny <string>(), It.IsAny <CancellationToken>())) .ReturnsAsync(new List <Proposal>() { proposal }); restServiceMock.Setup(s => s.ExecutePostAction <ActivationMessage>( It.IsAny <string>(), It.IsAny <ActivationMessage>(), It.IsAny <string>(), It.IsAny <CancellationToken>())) .ReturnsAsync(true); restServiceMock.Setup(s => s.ExecutePutAction <Proposal>( It.IsAny <string>(), It.IsAny <Proposal>(), It.IsAny <string>(), It.IsAny <CancellationToken>())) .ReturnsAsync(true); var options = ServiceProvider.Instance.Resolve <IOptions <AppSettings> >(); var proposalManagementService = new ProposalsManagementService(restServiceMock.Object, options) { RequestUri = RequestUriHelper.ProposalsUri, ActivationRequestUri = RequestUriHelper.ProposalsUri }; Assert.NotNull(_proposalsManagementService.CreateProposal(proposal, _token.Jwt).Result); Assert.True(_proposalsManagementService.DeleteProposal(proposal, _token.Jwt).Result); Assert.True(_proposalsManagementService.UpdateProposal(proposal, _token.Jwt).Result); Assert.NotNull(proposalManagementService.RequestUri); Assert.NotNull(proposalManagementService.ActivationRequestUri); Assert.True(proposalManagementService.SendActivationEmail(proposal.Id, _token.Jwt).Result); Assert.NotNull(proposalManagementService.GetProposal(proposal.Id, _token.Jwt).Result); }
public void TestOfGettingSpecifiedProposal() { var restServiceMock = new Mock <IRestService>(); restServiceMock.Setup(s => s.ExecuteGetAction <List <Proposal> >( It.IsAny <string>(), It.IsAny <string>(), It.IsAny <CancellationToken> ())) .ReturnsAsync(new List <Proposal>() { TestingObjectProvider.Instance.DoShallowCopy(_testingProposal) }); var options = ServiceProvider.Instance.Resolve <IOptions <AppSettings> >(); var proposalManagementService = new ProposalsManagementService(restServiceMock.Object, options) { RequestUri = RequestUriHelper.ProposalsUri, ActivationRequestUri = RequestUriHelper.ProposalsUri }; Assert.NotNull(proposalManagementService.GetProposal(_testingProposal.Id, _token.Jwt).Result); }