Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Fixes a NullReferenceException http headers are missing #64

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
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
11 changes: 7 additions & 4 deletions source/XeroAPI.Net.nuspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>XeroAPI.Net</id>
<version>0.0.0.0</version>
<id>Booyami.XeroAPI.Net</id>
<version>1.0.2</version>
<title>.Net wrapper library for Xero API</title>
<authors>XeroAPI</authors>
<owners />
Expand All @@ -11,9 +11,12 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>.Net wrapper library for Xero API. This library allows you to perform GET/PUT/POST methods against the Xero API without needing to know the internals of xml serialisation, oauth signatures or character encodings. See http://developer.xero.com for more information.</description>
<summary>.Net wrapper library for Xero API</summary>
<dependencies>
<dependency id="Booyami.DevDefined.OAuth" version="1.0.1" />
</dependencies>
</metadata>
<files>
<file src="XeroApi\bin\Release\XeroApi.dll" target="lib\XeroApi.dll" />
<file src="XeroApi\bin\Release\XeroApi.pdb" target="lib\XeroApi.pdb" />
<file src="XeroApi\bin\release\XeroApi.dll" target="lib\XeroApi.dll" />
<file src="XeroApi\bin\release\XeroApi.docs.xml" target="lib\XeroApi.docs.xml" />
</files>
</package>
Binary file removed source/XeroApi.ConsoleTests/Attachments/Receipt.png
Binary file not shown.
8 changes: 4 additions & 4 deletions source/XeroApi.ConsoleTests/PartnerApplicationRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using System.Diagnostics;
using System.Security.Cryptography.X509Certificates;

using DevDefined.OAuth.Consumer;
using DevDefined.OAuth.Framework;
using DevDefined.OAuth.Logging;
using DevDefined.OAuth.Storage.Basic;
using Booyami.DevDefined.OAuth.Consumer;
using Booyami.DevDefined.OAuth.Framework;
using Booyami.DevDefined.OAuth.Logging;
using Booyami.DevDefined.OAuth.Storage.Basic;
using XeroApi.OAuth;

namespace XeroApi.ConsoleApp
Expand Down
4 changes: 2 additions & 2 deletions source/XeroApi.ConsoleTests/PrivateApplicationRunner.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Security.Cryptography.X509Certificates;

using DevDefined.OAuth.Consumer;
using DevDefined.OAuth.Logging;
using Booyami.DevDefined.OAuth.Consumer;
using Booyami.DevDefined.OAuth.Logging;

using XeroApi.OAuth;

Expand Down
102 changes: 51 additions & 51 deletions source/XeroApi.ConsoleTests/Program.cs
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
using System;
using System.Collections.Generic;
using System.IO;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using DevDefined.OAuth.Utility;
using XeroApi.Model;
using XeroApi.Model.Reporting;

namespace XeroApi.ConsoleApp
{
class Program
using Booyami.DevDefined.OAuth.Utility;
using XeroApi.Model;
using XeroApi.Model.Reporting;
namespace XeroApi.ConsoleApp
{
class Program
{
private const string AnyAttachmentFilename = @".\Attachments\Receipt.png";
private const string TestContactName = "Joe Bloggs (Test)";

static void Main(string[] args)
{
Console.WriteLine("Do you want to run as a public or private application?");
Console.WriteLine(" Press 1 for a public application");
Console.WriteLine(" Press 2 for a private application");
Console.WriteLine(" Press 3 for a partner application");

ConsoleKeyInfo keyInfo = Console.ReadKey(true);
Console.WriteLine();

if (keyInfo.KeyChar == '1')
{
Console.WriteLine("Running as a public application...");
ExerciseOrganisation(PublicApplicationRunner.CreateRepository());
}
if (keyInfo.KeyChar == '2')
{
Console.WriteLine("Running as a private application...");
ExerciseOrganisation(PrivateApplicationRunner.CreateRepository());
}
if (keyInfo.KeyChar == '3')
{
Console.WriteLine("Running as a partner application...");
ExerciseOrganisation(PartnerApplicationRunner.CreateRepository());
}
}

static void ExerciseOrganisation(Repository repository)
{
if (repository == null)
{
return;
}

// Make a call to api.xero.com to check that we can use the access token.
Organisation organisation = repository.Organisation;

static void Main(string[] args)
{
Console.WriteLine("Do you want to run as a public or private application?");
Console.WriteLine(" Press 1 for a public application");
Console.WriteLine(" Press 2 for a private application");
Console.WriteLine(" Press 3 for a partner application");
ConsoleKeyInfo keyInfo = Console.ReadKey(true);
Console.WriteLine();
if (keyInfo.KeyChar == '1')
{
Console.WriteLine("Running as a public application...");
ExerciseOrganisation(PublicApplicationRunner.CreateRepository());
}
if (keyInfo.KeyChar == '2')
{
Console.WriteLine("Running as a private application...");
ExerciseOrganisation(PrivateApplicationRunner.CreateRepository());
}
if (keyInfo.KeyChar == '3')
{
Console.WriteLine("Running as a partner application...");
ExerciseOrganisation(PartnerApplicationRunner.CreateRepository());
}
}
static void ExerciseOrganisation(Repository repository)
{
if (repository == null)
{
return;
}
// Make a call to api.xero.com to check that we can use the access token.
Organisation organisation = repository.Organisation;
Console.WriteLine("You have been authorised against organisation: {0}", organisation.Name);

TestGetAccountsByFilter(repository);
Expand Down Expand Up @@ -77,7 +77,7 @@ static void ExerciseOrganisation(Repository repository)
TestGettingATrialBalance(repository);
TestGettingAListOfReports(repository);

Console.WriteLine("All done!");
Console.WriteLine("All done!");
}

private static void TestAttachmentsAgainstPurchaseInvoice(Repository repository)
Expand Down Expand Up @@ -527,7 +527,7 @@ private static void TestGetAccountsByFilter(Repository repository)
private static void TestGetOrganisaitonUsingLinqSingle(Repository repository)
{
// Try out the 'Single' linq method (http://answers.xero.com/developer/question/36501/)
var organisation = repository.Organisations.Single();
var organisation = repository.Organisations.Single();

Console.WriteLine("The organisation is still called: " + organisation.Name);
}
Expand All @@ -542,5 +542,5 @@ private static void TestGettingAListOfReports(Repository repository)
Console.WriteLine("Found published report, name:{0}, type:{1}", report.ReportName, report.ReportType);
}
}
}
}
}
}
8 changes: 4 additions & 4 deletions source/XeroApi.ConsoleTests/PublicApplicationRunner.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System;
using System.Diagnostics;

using DevDefined.OAuth.Consumer;
using DevDefined.OAuth.Framework;
using DevDefined.OAuth.Logging;
using DevDefined.OAuth.Storage.Basic;
using Booyami.DevDefined.OAuth.Consumer;
using Booyami.DevDefined.OAuth.Framework;
using Booyami.DevDefined.OAuth.Logging;
using Booyami.DevDefined.OAuth.Storage.Basic;
using XeroApi.OAuth;

namespace XeroApi.ConsoleApp
Expand Down
6 changes: 6 additions & 0 deletions source/XeroApi.ConsoleTests/XeroApi.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="Booyami.DevDefined.OAuth, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a3261f5b4697e67d, processorArchitecture=MSIL">
<HintPath>..\packages\Booyami.DevDefined.OAuth.1.0.1\lib\Booyami.DevDefined.OAuth.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
Expand All @@ -61,6 +64,9 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</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.
Expand Down
4 changes: 4 additions & 0 deletions source/XeroApi.ConsoleTests/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Booyami.DevDefined.OAuth" version="1.0.1" targetFramework="net35" />
</packages>
4 changes: 2 additions & 2 deletions source/XeroApi.MvcWebApp/Controllers/ConnectController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
using System.Diagnostics;
using System.Web.Mvc;

using DevDefined.OAuth.Consumer;
using DevDefined.OAuth.Storage.Basic;
using Booyami.DevDefined.OAuth.Consumer;
using Booyami.DevDefined.OAuth.Storage.Basic;

using Xero.ScreencastWeb.Services;

Expand Down
2 changes: 1 addition & 1 deletion source/XeroApi.MvcWebApp/Services/CertificateRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;

using DevDefined.OAuth.Consumer;
using Booyami.DevDefined.OAuth.Consumer;

namespace Xero.ScreencastWeb.Services
{
Expand Down
4 changes: 2 additions & 2 deletions source/XeroApi.MvcWebApp/Services/ServiceProvider.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Configuration;

using DevDefined.OAuth.Consumer;
using DevDefined.OAuth.Storage.Basic;
using Booyami.DevDefined.OAuth.Consumer;
using Booyami.DevDefined.OAuth.Storage.Basic;

using XeroApi;
using XeroApi.OAuth;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Web;

using DevDefined.OAuth.Consumer;
using DevDefined.OAuth.Storage.Basic;
using Booyami.DevDefined.OAuth.Consumer;
using Booyami.DevDefined.OAuth.Storage.Basic;

namespace Xero.ScreencastWeb.Services
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using DevDefined.OAuth.Consumer;
using Booyami.DevDefined.OAuth.Consumer;
using NUnit.Framework;

using Rhino.Mocks;
Expand Down
34 changes: 17 additions & 17 deletions source/XeroApi.Tests/OAuth/Consumer/ConsumerRequestTests.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
using System;
using System.Collections.Specialized;
using System.Net;
using DevDefined.OAuth.Consumer;
using DevDefined.OAuth.Framework;
using DevDefined.OAuth.Storage.Basic;
using NUnit.Framework;

using Rhino.Mocks;

namespace XeroApi.Tests.OAuth.Consumer
{
[TestFixture]
public class ConsumerRequestTests
{
[Test]
using Booyami.DevDefined.OAuth.Consumer;
using Booyami.DevDefined.OAuth.Framework;
using Booyami.DevDefined.OAuth.Storage.Basic;
using NUnit.Framework;
using Rhino.Mocks;
namespace XeroApi.Tests.OAuth.Consumer
{
[TestFixture]
public class ConsumerRequestTests
{
[Test]
public void to_consumer_response_with_really_old_date_string_should_fail_validation()
{
const string reallyOldDateString = "1000-01-01T00:00:00";
Expand Down Expand Up @@ -50,7 +50,7 @@ public void to_consumer_response_with_current_date_string_should_pass_validation
Assert.DoesNotThrow(() => consumerRequest.ToWebRequest());
}

[Test]
[Test]
public void it_can_parse_unset_IfModifiedSince_date()
{
ConsumerRequest consumerRequest = new ConsumerRequest(null, null, null, null);
Expand Down Expand Up @@ -143,6 +143,6 @@ private static ConsumerRequest NewConsumerRequest(OAuthContext oAuthContext)
};

return new ConsumerRequest(oAuthSession, oAuthContext, consumerContext, new NullCertificateFactory());
}
}
}
}
}
}
4 changes: 2 additions & 2 deletions source/XeroApi.Tests/SignatureTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Security.Cryptography.X509Certificates;
using DevDefined.OAuth.Consumer;
using DevDefined.OAuth.Framework;
using Booyami.DevDefined.OAuth.Consumer;
using Booyami.DevDefined.OAuth.Framework;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using XeroApi.OAuth;
Expand Down
Loading