fix up functionality, add tests
This commit is contained in:
@@ -5,7 +5,9 @@ VisualStudioVersion = 12.0.31101.0
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetrunnerDb.Net", "src\NetrunnerDb.Net\NetrunnerDb.Net.csproj", "{1B508DCB-3207-4597-B938-9218D32A41A4}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetrunnerDb.Net", "src\NetrunnerDb.Net\NetrunnerDb.Net.csproj", "{1B508DCB-3207-4597-B938-9218D32A41A4}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetrunnerDb.Net.Tests", "src\NetrunnerDb.Net.Tests\NetrunnerDb.Net.Tests.csproj", "{60115585-7F0E-438F-BC86-CCA9D6575062}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetrunnerDb.Net.UnitTests", "src\NetrunnerDb.Net.UnitTests\NetrunnerDb.Net.UnitTests.csproj", "{60115585-7F0E-438F-BC86-CCA9D6575062}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetrunnerDb.Net.AcceptanceTests", "src\NetrunnerDb.Net.AcceptanceTests\NetrunnerDb.Net.AcceptanceTests.csproj", "{B2585CDE-E2A6-4B28-8FC6-AD11CB28B13E}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -21,6 +23,10 @@ Global
|
|||||||
{60115585-7F0E-438F-BC86-CCA9D6575062}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{60115585-7F0E-438F-BC86-CCA9D6575062}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{60115585-7F0E-438F-BC86-CCA9D6575062}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{60115585-7F0E-438F-BC86-CCA9D6575062}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{60115585-7F0E-438F-BC86-CCA9D6575062}.Release|Any CPU.Build.0 = Release|Any CPU
|
{60115585-7F0E-438F-BC86-CCA9D6575062}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{B2585CDE-E2A6-4B28-8FC6-AD11CB28B13E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{B2585CDE-E2A6-4B28-8FC6-AD11CB28B13E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{B2585CDE-E2A6-4B28-8FC6-AD11CB28B13E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B2585CDE-E2A6-4B28-8FC6-AD11CB28B13E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -24,3 +24,7 @@ deploy:
|
|||||||
secure: fGNwXOtebe3kxu5SrB90CrbaCxVxuzuCQh3Ipcc0G/3cutoNZf7d7G6AaQ4fRv2l
|
secure: fGNwXOtebe3kxu5SrB90CrbaCxVxuzuCQh3Ipcc0G/3cutoNZf7d7G6AaQ4fRv2l
|
||||||
on:
|
on:
|
||||||
branch: master
|
branch: master
|
||||||
|
test:
|
||||||
|
categories:
|
||||||
|
- [Unit]
|
||||||
|
- [Acceptance]
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{B2585CDE-E2A6-4B28-8FC6-AD11CB28B13E}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>NetrunnerDb.Net.AcceptanceTests</RootNamespace>
|
||||||
|
<AssemblyName>NetrunnerDb.Net.AcceptanceTests</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="nunit.framework">
|
||||||
|
<HintPath>..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="QueryThings.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\NetrunnerDb.Net\NetrunnerDb.Net.csproj">
|
||||||
|
<Project>{1b508dcb-3207-4597-b938-9218d32a41a4}</Project>
|
||||||
|
<Name>NetrunnerDb.Net</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("NetrunnerDb.Net.AcceptanceTests")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("NetrunnerDb.Net.AcceptanceTests")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("a723e4fe-f081-4ca9-ac04-801a5f9b30e7")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
47
src/NetrunnerDb.Net.AcceptanceTests/QueryThings.cs
Normal file
47
src/NetrunnerDb.Net.AcceptanceTests/QueryThings.cs
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using NetrunnerDb.Net.Responses;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace NetrunnerDb.Net.AcceptanceTests
|
||||||
|
{
|
||||||
|
[TestFixture(Category = "Acceptance", Description = "Basic, hey can we do the things this project intends to do")]
|
||||||
|
public class QueryThings
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void OneCard()
|
||||||
|
{
|
||||||
|
Assert.AreEqual(new Repository().GetCard("01001").First().Title, "Noise: Hacker Extraordinaire");
|
||||||
|
}
|
||||||
|
[Test]
|
||||||
|
public void Cards()
|
||||||
|
{
|
||||||
|
Assert.IsTrue(new Repository().GetCards().Count > 100);
|
||||||
|
}
|
||||||
|
[Test]
|
||||||
|
public void Set()
|
||||||
|
{
|
||||||
|
Assert.IsTrue(new Repository().GetSet("tsb").Count > 10);
|
||||||
|
}
|
||||||
|
[Test]
|
||||||
|
public void Sets()
|
||||||
|
{
|
||||||
|
Assert.IsTrue(new Repository().GetSets().Count > 10);
|
||||||
|
}
|
||||||
|
[Test]
|
||||||
|
public void Decklist()
|
||||||
|
{
|
||||||
|
Assert.AreEqual(20866, new Repository().GetRequest<Decklist>("20866").First().Id);
|
||||||
|
}
|
||||||
|
[Test]
|
||||||
|
public void DecklistByDate()
|
||||||
|
{
|
||||||
|
var targetDate = new DateTime(2014, 01, 01);
|
||||||
|
Assert.IsTrue(new Repository().GetRequest<DecklistByDate>(targetDate.ToString("MM/dd/yyyy")).All(a =>
|
||||||
|
{
|
||||||
|
var parseDate = DateTime.Parse(a.Creation);
|
||||||
|
return (parseDate >= targetDate && parseDate <= parseDate.AddDays(1).AddMinutes(-1));
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
4
src/NetrunnerDb.Net.AcceptanceTests/packages.config
Normal file
4
src/NetrunnerDb.Net.AcceptanceTests/packages.config
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="NUnit" version="2.6.4" targetFramework="net45" />
|
||||||
|
</packages>
|
||||||
@@ -1,12 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using NetrunnerDb.Net.Responses;
|
using NetrunnerDb.Net.Responses;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace NetrunnerDb.Net.Tests
|
namespace NetrunnerDb.Net.UnitTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class Class1
|
public class Class1
|
||||||
@@ -7,8 +7,8 @@
|
|||||||
<ProjectGuid>{60115585-7F0E-438F-BC86-CCA9D6575062}</ProjectGuid>
|
<ProjectGuid>{60115585-7F0E-438F-BC86-CCA9D6575062}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>NetrunnerDb.Net.Tests</RootNamespace>
|
<RootNamespace>NetrunnerDb.Net.UnitTests</RootNamespace>
|
||||||
<AssemblyName>NetrunnerDb.Net.Tests</AssemblyName>
|
<AssemblyName>NetrunnerDb.Net.UnitTests</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@@ -30,6 +30,9 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="Moq">
|
||||||
|
<HintPath>..\..\packages\Moq.4.2.1502.0911\lib\net40\Moq.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="nunit.core">
|
<Reference Include="nunit.core">
|
||||||
<HintPath>..\..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll</HintPath>
|
<HintPath>..\..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
@@ -61,6 +64,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Class1.cs" />
|
<Compile Include="Class1.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="RequestTests\EndpointInterfaceTesting.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using NetrunnerDb.Net.Responses;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace NetrunnerDb.Net.UnitTests.RequestTests
|
||||||
|
{
|
||||||
|
[TestFixture(Category = "Unit")]
|
||||||
|
public class EndpointInterfaceTesting
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestSmallEndpoints()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentOutOfRangeException>(()=>new Cards().EndPoint("not null string"));
|
||||||
|
Assert.Throws<ArgumentOutOfRangeException>(() => new Sets().EndPoint("not null string"));
|
||||||
|
Assert.Throws<ArgumentNullException>(() => new Decklist().EndPoint(String.Empty));
|
||||||
|
Assert.Throws<ArgumentNullException>(() => new Set().EndPoint(String.Empty));
|
||||||
|
Assert.Throws<ArgumentOutOfRangeException>(() => new OneCard().EndPoint(String.Empty));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestDecklistEndpointDateTimeOverride()
|
||||||
|
{
|
||||||
|
var mockedDatetime = new DateTime(2014, 1, 1);
|
||||||
|
var decklistByDate = new DecklistByDate(mockedDatetime);
|
||||||
|
var decklistEndpoint = decklistByDate.EndPoint();
|
||||||
|
var date = decklistEndpoint.Split('/').Last();
|
||||||
|
Assert.AreEqual(date, "2014-01-01");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestDecklistEndpoint()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentNullException>(() => new DecklistByDate().EndPoint(String.Empty));
|
||||||
|
Assert.Throws<FormatException>(() => new DecklistByDate().EndPoint("awesome"));
|
||||||
|
var decklistByDate = new DecklistByDate();
|
||||||
|
var decklistEndpoint = decklistByDate.EndPoint("01/01/2014");
|
||||||
|
var date = decklistEndpoint.Split('/').Last();
|
||||||
|
Assert.AreEqual(date, "2014-01-01");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
|
<package id="Moq" version="4.2.1502.0911" targetFramework="net45" />
|
||||||
<package id="NUnit" version="2.6.4" targetFramework="net45" />
|
<package id="NUnit" version="2.6.4" targetFramework="net45" />
|
||||||
<package id="NUnitTestAdapter" version="2.0.0" targetFramework="net45" />
|
<package id="NUnitTestAdapter" version="2.0.0" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -22,7 +22,8 @@ namespace NetrunnerDb.Net
|
|||||||
where TResult : class, IRequest, new()
|
where TResult : class, IRequest, new()
|
||||||
{
|
{
|
||||||
var s = new TResult();
|
var s = new TResult();
|
||||||
var request = new RestRequest(){
|
var request = new RestRequest
|
||||||
|
{
|
||||||
Resource = s.EndPoint(parameter)
|
Resource = s.EndPoint(parameter)
|
||||||
};
|
};
|
||||||
var client = new RestClient("http://netrunnerdb.com");
|
var client = new RestClient("http://netrunnerdb.com");
|
||||||
@@ -52,9 +53,9 @@ namespace NetrunnerDb.Net
|
|||||||
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
||||||
/// <exception cref="ArgumentNullException"></exception>
|
/// <exception cref="ArgumentNullException"></exception>
|
||||||
/// <exception cref="FormatException"></exception>
|
/// <exception cref="FormatException"></exception>
|
||||||
public IList<Sets> GetSet(string code)
|
public IList<Set> GetSet(string code)
|
||||||
{
|
{
|
||||||
return GetRequest<Sets>(code);
|
return GetRequest<Set>(code);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// /api/cards/ returns data about all the cards in the database.
|
/// /api/cards/ returns data about all the cards in the database.
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace NetrunnerDb.Net.Responses
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace NetrunnerDb.Net.Responses
|
|
||||||
{
|
{
|
||||||
public abstract class BaseRequest : IRequest
|
public abstract class BaseRequest : IRequest
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -111,6 +111,12 @@ namespace NetrunnerDb.Net.Responses
|
|||||||
[JsonProperty("trash")]
|
[JsonProperty("trash")]
|
||||||
public int? Trash { get; set; }
|
public int? Trash { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Configure Endpoint
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parameter"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="ArgumentOutOfRangeException">parameter</exception>
|
||||||
public override string EndPoint(string parameter = "")
|
public override string EndPoint(string parameter = "")
|
||||||
{
|
{
|
||||||
//this endpoint should not be passed a parameter
|
//this endpoint should not be passed a parameter
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace NetrunnerDb.Net.Responses
|
namespace NetrunnerDb.Net.Responses
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
namespace NetrunnerDb.Net.Responses
|
namespace NetrunnerDb.Net.Responses
|
||||||
{
|
{
|
||||||
|
|
||||||
public class DecklistByDate : BaseRequest
|
public class DecklistByDate : BaseRequest
|
||||||
{
|
{
|
||||||
public DecklistByDate() { }
|
public DecklistByDate() { }
|
||||||
@@ -36,7 +37,7 @@ namespace NetrunnerDb.Net.Responses
|
|||||||
{
|
{
|
||||||
if (Endpoint.HasValue)
|
if (Endpoint.HasValue)
|
||||||
{
|
{
|
||||||
return string.Format("/api/decklists/by_date/{0}", Endpoint.Value.ToString("yy-MM-dd"));
|
return string.Format("/api/decklists/by_date/{0}", Endpoint.Value.ToString("yyyy-MM-dd"));
|
||||||
}
|
}
|
||||||
if (string.IsNullOrWhiteSpace(parameter))
|
if (string.IsNullOrWhiteSpace(parameter))
|
||||||
{
|
{
|
||||||
@@ -45,7 +46,7 @@ namespace NetrunnerDb.Net.Responses
|
|||||||
DateTime dateTime;
|
DateTime dateTime;
|
||||||
if (DateTime.TryParse(parameter, out dateTime))
|
if (DateTime.TryParse(parameter, out dateTime))
|
||||||
{
|
{
|
||||||
return string.Format("/api/decklists/by_date/{0}", dateTime.ToString("yy-MM-dd"));
|
return string.Format("/api/decklists/by_date/{0}", dateTime.ToString("yyyy-MM-dd"));
|
||||||
}
|
}
|
||||||
throw new FormatException(string.Format("{0} is not a valid date format"));
|
throw new FormatException(string.Format("{0} is not a valid date format"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace NetrunnerDb.Net.Responses
|
namespace NetrunnerDb.Net.Responses
|
||||||
@@ -93,7 +89,7 @@ namespace NetrunnerDb.Net.Responses
|
|||||||
//we should be passed an actual param
|
//we should be passed an actual param
|
||||||
if (string.IsNullOrWhiteSpace(parameter))
|
if (string.IsNullOrWhiteSpace(parameter))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("parameter");
|
throw new ArgumentOutOfRangeException("parameter", "Endpoint OneCard requires a parameter");
|
||||||
}
|
}
|
||||||
return string.Format("/api/card/{0}", parameter);
|
return string.Format("/api/card/{0}", parameter);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user