Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion NewsAPI.Tests/Tests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NewsAPI.Models;
using System.Configuration;
using NewsAPI.Constants;

namespace NewsAPI.Tests
Expand Down Expand Up @@ -37,6 +37,22 @@ public void BasicEverythingRequestWorks()
Assert.IsNull(result.Error);
}

[TestMethod]
public void EverythingRequestWithDomainsWorks()
{
var everythingRequest = new EverythingRequest
{
Domains = new List<String>(new []{ "wsj.com", "nytimes.com" })
};

var result = NewsApiClient.GetEverything(everythingRequest);

Assert.AreEqual(Statuses.Ok, result.Status);
Assert.IsTrue(result.TotalResults > 0);
Assert.IsTrue(result.Articles.Count > 0);
Assert.IsNull(result.Error);
}

[TestMethod]
public void ComplexEverythingRequestWorks()
{
Expand Down
4 changes: 1 addition & 3 deletions NewsAPI/NewsApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace NewsAPI
Expand Down Expand Up @@ -126,7 +124,7 @@ public async Task<ArticlesResult> GetEverythingAsync(EverythingRequest request)
// domains
if (request.Domains.Count > 0)
{
queryParams.Add("domains=" + string.Join(",", request.Sources));
queryParams.Add("domains=" + string.Join(",", request.Domains));
}

// from
Expand Down
2 changes: 1 addition & 1 deletion NewsAPI/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="portable45-net45+win8+wpa81" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="portable45-net45+win8+wpa81" />
</packages>