public void GetGetByOrganizationIdOrProjectId()
        {
            RemoveData();

            _repository.Add(new WebHook {
                OrganizationId = TestConstants.OrganizationId, Url = "http://localhost:40000/test1", EventTypes = new[] { WebHookRepository.EventTypes.StackPromoted }
            });
            _repository.Add(new WebHook {
                OrganizationId = TestConstants.OrganizationId, ProjectId = TestConstants.ProjectId, Url = "http://localhost:40000/test", EventTypes = new[] { WebHookRepository.EventTypes.StackPromoted }
            });

            Assert.Equal(2, _repository.GetByOrganizationId(TestConstants.OrganizationId).Count);
            Assert.Equal(2, _repository.GetByOrganizationIdOrProjectId(TestConstants.OrganizationId, TestConstants.ProjectId).Count);
            Assert.Equal(1, _repository.GetByProjectId(TestConstants.ProjectId).Count);
        }
Exemplo n.º 2
0
        public async Task <Unit> Handle(AddWebHookCommand request, CancellationToken cancellationToken)
        {
            await _cartService.ValidateCartId(request.CartId);

            await _webHookRepository.Add(request.CartId, request.WebHook);

            return(Unit.Value);
        }