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
4 changes: 2 additions & 2 deletions NewsAPI.Tests/App.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
</configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration>
12 changes: 6 additions & 6 deletions NewsAPI.Tests/NewsAPI.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -36,7 +37,6 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Configuration" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
Expand All @@ -54,17 +54,17 @@
<Compile Include="Tests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NewsAPI\NewsAPI.csproj">
<Project>{86cdf033-3cae-4845-98bf-70575df27e2b}</Project>
<Name>NewsAPI</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
Expand Down
15 changes: 15 additions & 0 deletions NewsAPI.Tests/Tests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NewsAPI.Models;
using System.Configuration;
Expand All @@ -21,6 +22,20 @@ public void Init()
NewsApiClient = new NewsApiClient(apiKey);
}

[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 BasicEverythingRequestWorks()
{
Expand Down
8 changes: 1 addition & 7 deletions NewsAPI/Constants/Categories.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace NewsAPI.Constants
{
Expand All @@ -19,4 +13,4 @@ public enum Categories
Sports,
Technology
}
}
}
85 changes: 52 additions & 33 deletions NewsAPI/Constants/Countries.cs
Original file line number Diff line number Diff line change
@@ -1,125 +1,143 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NewsAPI.Constants
namespace NewsAPI.Constants
{
public enum Countries
{
AE,

/// <summary>
/// Argentina
/// Argentina
/// </summary>
AR,

/// <summary>
/// Austria
/// Austria
/// </summary>
AT,

/// <summary>
/// Australia
/// Australia
/// </summary>
AU,

/// <summary>
/// Belgium
/// Belgium
/// </summary>
BE,
BG,
BR,

/// <summary>
/// Canada
/// Canada
/// </summary>
CA,
CH,

/// <summary>
/// China
/// China
/// </summary>
CN,
CO,
CU,

/// <summary>
/// Czech Republic
/// Czech Republic
/// </summary>
CZ,

/// <summary>
/// Germany
/// Germany
/// </summary>
DE,

/// <summary>
/// Egypt
/// Egypt
/// </summary>
EG,

/// <summary>
/// France
/// France
/// </summary>
FR,

/// <summary>
/// United Kingdom
/// United Kingdom
/// </summary>
GB,

/// <summary>
/// Greece
/// Greece
/// </summary>
GR,

/// <summary>
/// Hong Kong
/// Hong Kong
/// </summary>
HK,

/// <summary>
/// Hungary
/// Hungary
/// </summary>
HU,
ID,

/// <summary>
/// Ireland
/// Ireland
/// </summary>
IE,
IL,
IN,

/// <summary>
/// Italy
/// Italy
/// </summary>
IT,

/// <summary>
/// Japan
/// Japan
/// </summary>
JP,

/// <summary>
/// South Korea
/// South Korea
/// </summary>
KR,
LT,
LV,
MA,

/// <summary>
/// Mexico
/// Mexico
/// </summary>
MX,
MY,
NG,

/// <summary>
/// Netherlands
/// Netherlands
/// </summary>
NL,

/// <summary>
/// Norway
/// Norway
/// </summary>
NO,

/// <summary>
/// New Zealand
/// New Zealand
/// </summary>
NZ,
PH,
PL,

/// <summary>
/// Portugal
/// Portugal
/// </summary>
PT,
RO,
RS,

/// <summary>
/// Russia
/// Russia
/// </summary>
RU,
SA,
Expand All @@ -131,11 +149,12 @@ public enum Countries
TR,
TW,
UA,

/// <summary>
/// United States
/// United States
/// </summary>
US,
VE,
ZA
}
}
}
10 changes: 2 additions & 8 deletions NewsAPI/Constants/ErrorCodes.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NewsAPI.Constants
namespace NewsAPI.Constants
{
public enum ErrorCodes
{
Expand All @@ -24,4 +18,4 @@ public enum ErrorCodes
UnexpectedError,
UnknownError
}
}
}
36 changes: 19 additions & 17 deletions NewsAPI/Constants/Languages.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NewsAPI.Constants
namespace NewsAPI.Constants
{
public enum Languages
{
/// <summary>
/// Afrikaans (South Africa)
/// Afrikaans (South Africa)
/// </summary>
AF,
AN,
Expand All @@ -23,18 +17,21 @@ public enum Languages
CS,
CY,
DA,

/// <summary>
/// German
/// German
/// </summary>
DE,
EL,

/// <summary>
/// English
/// English
/// </summary>
EN,
EO,

/// <summary>
/// Spanish
/// Spanish
/// </summary>
ES,
ET,
Expand All @@ -51,12 +48,14 @@ public enum Languages
HY,
ID,
IS,

/// <summary>
/// Italian
/// Italian
/// </summary>
IT,

/// <summary>
/// Japanese
/// Japanese
/// </summary>
JP,
JV,
Expand All @@ -71,16 +70,18 @@ public enum Languages
ML,
MR,
MS,

/// <summary>
/// Dutch
/// Dutch
/// </summary>
NL,
NN,
NO,
OC,
PL,

/// <summary>
/// Portuguese
/// Portuguese
/// </summary>
PT,
RO,
Expand All @@ -101,9 +102,10 @@ public enum Languages
UR,
VI,
VO,

/// <summary>
/// Chinese
/// Chinese
/// </summary>
ZH
}
}
}
Loading