public async Task Add_AddsNewUrlReferrer()
        {
            var newUrlReferer = new UrlReferrerDto
            {
                Host = "someaddedhost.test"
            };

            //Create new urlReferrer
            var postResponse = await _client.PostAsync($"/api/v1/urlreferrers/", newUrlReferer.ToJsonContent());

            postResponse.EnsureSuccessStatusCode();

            //Get newly created urlReferrer
            var getResponse = await _client.GetAsync($"/api/v1/urlreferrers/{newUrlReferer.Host}");

            getResponse.EnsureSuccessStatusCode();

            var createdUrlReferrer = getResponse.ReadResponseContent <UrlReferrerDto>();

            Assert.NotNull(createdUrlReferrer);
            Assert.Equal(newUrlReferer.Host, createdUrlReferrer.Host);
        }
Пример #2
0
        public async Task <ActionResult> Add([FromBody] UrlReferrerDto urlReferrerDto)
        {
            await _urlReferrerRepository.AddOrUpdateAsync(urlReferrerDto.ToUrlReferrer());

            return(Ok());
        }