Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
all get method implemented. Heavy refactoring to come soon.
- Loading branch information
Showing
84 changed files
with
39,242 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,31 @@ | ||
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs) | ||
bin | ||
obj | ||
|
||
# mstest test results | ||
TestResults | ||
#ignore thumbnails created by windows | ||
Thumbs.db | ||
#Ignore files build by Visual Studio | ||
*.obj | ||
*.pdb | ||
*.user | ||
*.aps | ||
*.pch | ||
*.vspscc | ||
*_i.c | ||
*_p.c | ||
*.ncb | ||
*.suo | ||
*.tlb | ||
*.tlh | ||
*.bak | ||
*.cache | ||
*.ilk | ||
*.log | ||
ClientBin | ||
[Bb]in | ||
[Dd]ebug*/ | ||
*.lib | ||
*.sbr | ||
obj/ | ||
[Rr]elease*/ | ||
_ReSharper*/ | ||
*.csproj.user | ||
*.resharper* | ||
#nuget stuff | ||
packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 11.00 | ||
# Visual Studio 2010 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Website", "Website\Website.csproj", "{73B28B91-C49F-4B36-B7CF-C0E6C8994486}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsanaApi", "AsanaApi\AsanaApi.csproj", "{3A261803-E7CA-4F47-B216-F559660869FB}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsanaApi.Tests", "AsanaApi.Tests\AsanaApi.Tests.csproj", "{40E31301-EA74-45F4-BBA8-0EFE93B33825}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{73B28B91-C49F-4B36-B7CF-C0E6C8994486}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{73B28B91-C49F-4B36-B7CF-C0E6C8994486}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{73B28B91-C49F-4B36-B7CF-C0E6C8994486}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{73B28B91-C49F-4B36-B7CF-C0E6C8994486}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{3A261803-E7CA-4F47-B216-F559660869FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{3A261803-E7CA-4F47-B216-F559660869FB}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{3A261803-E7CA-4F47-B216-F559660869FB}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{3A261803-E7CA-4F47-B216-F559660869FB}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{40E31301-EA74-45F4-BBA8-0EFE93B33825}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{40E31301-EA74-45F4-BBA8-0EFE93B33825}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{40E31301-EA74-45F4-BBA8-0EFE93B33825}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{40E31301-EA74-45F4-BBA8-0EFE93B33825}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<appSettings> | ||
|
||
<!--START Replace Me--> | ||
<add key="testApiKey" value="XXXXXXXXXXXXXXXXXXX" /> | ||
<add key="testUserId" value="123123123123123" /> | ||
<add key="testUserName" value="User Name" /> | ||
<add key="testWorkspaceId" value="123123123123123" /> | ||
<add key="testProjectId" value="123123123123123" /> | ||
<!--END Replace Me--> | ||
|
||
</appSettings> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>8.0.30703</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{40E31301-EA74-45F4-BBA8-0EFE93B33825}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>AsanaApi.Tests</RootNamespace> | ||
<AssemblyName>AsanaApi.Tests</AssemblyName> | ||
<TargetFrameworkVersion>v4.0</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="Gallio, Version=3.3.0.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\packages\mbunit.3.3.454.0\lib\net40\Gallio.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Gallio40, Version=3.3.0.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\packages\mbunit.3.3.454.0\lib\net40\Gallio40.dll</HintPath> | ||
</Reference> | ||
<Reference Include="MbUnit, Version=3.3.0.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\packages\mbunit.3.3.454.0\lib\net40\MbUnit.dll</HintPath> | ||
</Reference> | ||
<Reference Include="MbUnit40, Version=3.3.0.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\packages\mbunit.3.3.454.0\lib\net40\MbUnit40.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Configuration" /> | ||
<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="BaseTest.cs" /> | ||
<Compile Include="Models\TargetTests.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Service\StoriesTests.cs" /> | ||
<Compile Include="Service\ProjectsTests.cs" /> | ||
<Compile Include="Service\TasksTests.cs" /> | ||
<Compile Include="Service\UserTests.cs" /> | ||
<Compile Include="Service\WorkspaceTests.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\AsanaApi\AsanaApi.csproj"> | ||
<Project>{3A261803-E7CA-4F47-B216-F559660869FB}</Project> | ||
<Name>AsanaApi</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config"> | ||
<SubType>Designer</SubType> | ||
</None> | ||
<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. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace AsanaApi.Tests | ||
{ | ||
public abstract class BaseTest | ||
{ | ||
protected readonly string API_KEY, | ||
TEST_USER_NAME; | ||
|
||
protected readonly long TEST_USER_ID, | ||
TEST_WORKSPACE_ID, | ||
TEST_PROJECT_ID; | ||
|
||
public BaseTest() | ||
{ | ||
API_KEY = System.Configuration.ConfigurationManager.AppSettings[ "testApiKey" ]; | ||
TEST_USER_NAME = System.Configuration.ConfigurationManager.AppSettings[ "testUserName" ]; | ||
|
||
TEST_USER_ID = long.Parse( System.Configuration.ConfigurationManager.AppSettings[ "testUserId" ] ); | ||
TEST_WORKSPACE_ID = long.Parse( System.Configuration.ConfigurationManager.AppSettings[ "testWorkspaceId" ] ); | ||
TEST_PROJECT_ID = long.Parse( System.Configuration.ConfigurationManager.AppSettings[ "testProjectId" ] ); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using MbUnit.Framework; | ||
using AsanaApi.Models; | ||
|
||
namespace AsanaApi.Tests.Models | ||
{ | ||
[TestFixture] | ||
public class TargetTests : BaseTest | ||
{ | ||
[Test] | ||
public void PointlessTest() | ||
{ | ||
Project project = new Project() { Id = 100 }; | ||
Task task = new Task(){ Id = 100 }; | ||
|
||
Assert.IsTrue( project is ITarget, "project should be a ITarget" ); | ||
Assert.IsTrue( task is ITarget, "project should be a ITarget" ); | ||
|
||
AssertITargetId( 100, project ); | ||
AssertITargetId( 100, task ); | ||
} | ||
|
||
private void AssertITargetId( long id, ITarget iTarget ) | ||
{ | ||
Assert.AreEqual( id, iTarget.Id, "Id is incorrect" ); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
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( "AsanaApi.Tests" )] | ||
[assembly: AssemblyDescription( "" )] | ||
[assembly: AssemblyConfiguration( "" )] | ||
[assembly: AssemblyCompany( "Everyone" )] | ||
[assembly: AssemblyProduct( "AsanaApi.Tests" )] | ||
[assembly: AssemblyCopyright( "Copyright © Everyone 2012" )] | ||
[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( "7ddecd40-826a-4a9f-97a1-1e58450baa3d" )] | ||
|
||
// 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" )] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using MbUnit.Framework; | ||
using AsanaApi.Service; | ||
using AsanaApi.Models; | ||
|
||
namespace AsanaApi.Tests.Service | ||
{ | ||
[TestFixture] | ||
public class ProjectsTests : BaseTest | ||
{ | ||
[Test] | ||
public void GetProjects() | ||
{ | ||
ProjectsService service = new ProjectsService( API_KEY ); | ||
Project[] projects = service.GetProjects(); | ||
Assert.IsNotNull( projects, "we should have gotten some projects back" ); | ||
foreach( var item in projects ) | ||
{ | ||
Assert.IsNotNull( item.Name, "name should always come back" ); | ||
Assert.AreEqual( DateTime.MinValue, item.CreatedAt, "CreatedAt isn't populated by default" ); | ||
Assert.IsFalse( item.ModifiedAt.HasValue, "modified date is null" ); | ||
Assert.IsNull( item.Followers, "shouldn't be any followers" ); | ||
} | ||
} | ||
|
||
[Test] | ||
public void GetProjectsWithFields() | ||
{ | ||
ProjectsService service = new ProjectsService( API_KEY ); | ||
Project[] projects = service.GetProjects( new OptionalFields[] { OptionalFields.Project_CreatedAt, OptionalFields.Project_ModifiedAt } ); | ||
Assert.IsNotNull( projects, "we should have gotten some projects back" ); | ||
|
||
foreach( var item in projects ) | ||
{ | ||
Assert.IsNotNull( item.Name, "name should always come back" ); | ||
Assert.AreNotEqual( DateTime.MinValue, item.CreatedAt, "CreatedAt should be populated" ); | ||
Assert.IsTrue( item.ModifiedAt.HasValue, "modified date shouldn't be null" ); | ||
Assert.IsNull( item.Followers, "shouldn't be any followers" ); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using MbUnit.Framework; | ||
using AsanaApi.Service; | ||
using AsanaApi.Models; | ||
|
||
namespace AsanaApi.Tests.Service | ||
{ | ||
[TestFixture] | ||
public class StoriesTests : BaseTest | ||
{ | ||
[Test] | ||
public void GetStories() | ||
{ | ||
TasksService ts = new TasksService( API_KEY ); | ||
Task t = ts.GetTasksInProject( TEST_PROJECT_ID )[ 0 ]; | ||
|
||
StoriesService service = new StoriesService( API_KEY ); | ||
Story[] stories = service.GetStories( t ); | ||
Assert.IsNotNull( stories, "we should have gotten some stories back" ); | ||
Assert.IsTrue( stories.Length > 0, "stories.Length was only " + stories.Length.ToString() ); | ||
foreach( var item in stories ) | ||
{ | ||
Assert.IsNotNull( item.Text, "text should always come back" ); | ||
Assert.IsTrue( item.Type.HasValue, "type should always be populated" ); | ||
Assert.IsNotNull( item.CreatedBy, "CreatedBy should be back now" ); | ||
} | ||
} | ||
|
||
[Test] | ||
public void GetTotalStory() | ||
{ | ||
TasksService ts = new TasksService( API_KEY ); | ||
Task t = ts.GetTasksInProject( TEST_PROJECT_ID )[ 0 ]; | ||
|
||
StoriesService service = new StoriesService( API_KEY ); | ||
Story[] stories = service.GetStories( t, StoriesService.AllOptionalFieldsForStories ); | ||
Assert.IsNotNull( stories, "we should have gotten some stories back" ); | ||
Assert.IsTrue( stories.Length > 0, "stories.Length was only " + stories.Length.ToString() ); | ||
foreach( var item in stories ) | ||
{ | ||
Assert.IsNotNull( item.Text, "text should always come back" ); | ||
Assert.IsTrue( item.Type.HasValue, "type should always be populated" ); | ||
Assert.IsNotNull( item.CreatedBy, "CreatedBy should be back now" ); | ||
Assert.IsNotNull( item.Target, "Target should be back now" ); | ||
Assert.IsTrue( item.Source.HasValue, "Source should be back now" ); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.