Skip to content

Commit 987d539

Browse files
committed
Update public specs.
1 parent 3fa0ccc commit 987d539

File tree

92 files changed

+848
-511
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+848
-511
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProjectGuid>{0FDF769B-43F8-4907-98D5-A413BD9DE62D}</ProjectGuid>
7+
<OutputType>Library</OutputType>
8+
<AppDesignerFolder>Properties</AppDesignerFolder>
9+
<RootNamespace>Dropbox.Api.Tests</RootNamespace>
10+
<AssemblyName>Dropbox.Api.Tests</AssemblyName>
11+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
14+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
15+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
16+
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
17+
<IsCodedUITest>False</IsCodedUITest>
18+
<TestProjectType>UnitTest</TestProjectType>
19+
<TargetFrameworkProfile />
20+
</PropertyGroup>
21+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
22+
<DebugSymbols>true</DebugSymbols>
23+
<DebugType>full</DebugType>
24+
<Optimize>false</Optimize>
25+
<OutputPath>bin\Debug\</OutputPath>
26+
<DefineConstants>DEBUG;TRACE</DefineConstants>
27+
<ErrorReport>prompt</ErrorReport>
28+
<WarningLevel>4</WarningLevel>
29+
<Prefer32Bit>false</Prefer32Bit>
30+
</PropertyGroup>
31+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
32+
<DebugType>pdbonly</DebugType>
33+
<Optimize>true</Optimize>
34+
<OutputPath>bin\Release\</OutputPath>
35+
<DefineConstants>TRACE</DefineConstants>
36+
<ErrorReport>prompt</ErrorReport>
37+
<WarningLevel>4</WarningLevel>
38+
<Prefer32Bit>false</Prefer32Bit>
39+
</PropertyGroup>
40+
<ItemGroup>
41+
<Reference Include="System" />
42+
<Reference Include="System.Core">
43+
<RequiredTargetFramework>3.5</RequiredTargetFramework>
44+
</Reference>
45+
</ItemGroup>
46+
<Choose>
47+
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
48+
<ItemGroup>
49+
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
50+
</ItemGroup>
51+
</When>
52+
<Otherwise>
53+
<ItemGroup>
54+
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
55+
</ItemGroup>
56+
</Otherwise>
57+
</Choose>
58+
<ItemGroup>
59+
<Compile Include="DropboxApiTests.cs" />
60+
<Compile Include="Properties\AssemblyInfo.cs" />
61+
</ItemGroup>
62+
<ItemGroup>
63+
<None Include="dropbox.runsettings" />
64+
</ItemGroup>
65+
<ItemGroup>
66+
<ProjectReference Include="..\Dropbox.Api\Dropbox.Api.csproj">
67+
<Project>{68180b54-4724-4cd1-baa6-ee7bc309797c}</Project>
68+
<Name>Dropbox.Api</Name>
69+
</ProjectReference>
70+
</ItemGroup>
71+
<Choose>
72+
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
73+
<ItemGroup>
74+
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
75+
<Private>False</Private>
76+
</Reference>
77+
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
78+
<Private>False</Private>
79+
</Reference>
80+
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
81+
<Private>False</Private>
82+
</Reference>
83+
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
84+
<Private>False</Private>
85+
</Reference>
86+
</ItemGroup>
87+
</When>
88+
</Choose>
89+
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
90+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
91+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
92+
Other similar extension points exist, see Microsoft.Common.targets.
93+
<Target Name="BeforeBuild">
94+
</Target>
95+
<Target Name="AfterBuild">
96+
</Target>
97+
-->
98+
</Project>
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
//-----------------------------------------------------------------------------
2+
// <copyright file="ApiException.cs" company="Dropbox Inc">
3+
// Copyright (c) Dropbox Inc. All rights reserved.
4+
// </copyright>
5+
//-----------------------------------------------------------------------------
6+
7+
namespace Dropbox.Api.Tests
8+
{
9+
using System;
10+
using System.Collections.Generic;
11+
using System.IO;
12+
using System.Text;
13+
using System.Threading.Tasks;
14+
15+
using Microsoft.VisualStudio.TestTools.UnitTesting;
16+
17+
/// <summary>
18+
/// The test class for Dropbox API.
19+
/// </summary>
20+
[TestClass]
21+
public class DropboxApiTests
22+
{
23+
/// <summary>
24+
/// The Dropbox client.
25+
/// </summary>
26+
public static DropboxClient Client;
27+
28+
[ClassInitialize]
29+
public static void Initialize(TestContext context)
30+
{
31+
var token = context.Properties["accessToken"].ToString();
32+
Client = new DropboxClient(token);
33+
}
34+
35+
36+
[TestCleanup]
37+
public void Cleanup()
38+
{
39+
var result = Client.Files.ListFolderAsync("").Result;
40+
41+
foreach (var entry in result.Entries) {
42+
Client.Files.DeleteAsync(entry.PathLower).Wait();
43+
}
44+
}
45+
46+
/// <summary>
47+
/// Test get metadata.
48+
/// </summary>
49+
/// <returns>The <see cref="Task"/></returns>
50+
[TestMethod]
51+
public async Task TestGetMetadata()
52+
{
53+
await Client.Files.UploadAsync("/Foo.txt", body: GetStream("abc"));
54+
var metadata = await Client.Files.GetMetadataAsync("/Foo.txt");
55+
Assert.AreEqual("Foo.txt", metadata.Name);
56+
Assert.AreEqual("/foo.txt", metadata.PathLower);
57+
Assert.AreEqual("/Foo.txt", metadata.PathDisplay);
58+
Assert.IsTrue(metadata.IsFile);
59+
60+
var file = metadata.AsFile;
61+
Assert.AreEqual(3, (int)file.Size);
62+
}
63+
64+
/// <summary>
65+
/// Test get metadata.
66+
/// </summary>
67+
/// <returns>The <see cref="Task"/></returns>
68+
[TestMethod]
69+
public async Task TestListFolder()
70+
{
71+
var files = new HashSet<string> { "/a.txt", "/b.txt", "/c.txt" };
72+
foreach (var file in files)
73+
{
74+
await Client.Files.UploadAsync(file, body: GetStream("abc"));
75+
}
76+
77+
var response = await Client.Files.ListFolderAsync("");
78+
Assert.AreEqual(files.Count, response.Entries.Count);
79+
foreach (var entry in response.Entries)
80+
{
81+
Assert.IsTrue(files.Contains(entry.PathLower));
82+
Assert.IsTrue(entry.IsFile);
83+
var file = entry.AsFile;
84+
Assert.AreEqual(3, (int)file.Size);
85+
}
86+
}
87+
88+
/// <summary>
89+
/// Test upload.
90+
/// </summary>
91+
/// <returns>The <see cref="Task"/></returns>
92+
[TestMethod]
93+
public async Task TestUpload()
94+
{
95+
var response = await Client.Files.UploadAsync("/Foo.txt", body: GetStream("abc"));
96+
Assert.AreEqual(response.Name, "Foo.txt");
97+
Assert.AreEqual(response.PathLower, "/foo.txt");
98+
Assert.AreEqual(response.PathDisplay, "/Foo.txt");
99+
var downloadResponse = await Client.Files.DownloadAsync("/Foo.txt");
100+
var content = await downloadResponse.GetContentAsStringAsync();
101+
Assert.AreEqual("abc", content);
102+
}
103+
104+
/// <summary>
105+
/// Test upload.
106+
/// </summary>
107+
/// <returns>The <see cref="Task"/></returns>
108+
[TestMethod]
109+
public async Task TestDownload()
110+
{
111+
await Client.Files.UploadAsync("/Foo.txt", body: GetStream("abc"));
112+
var downloadResponse = await Client.Files.DownloadAsync("/Foo.txt");
113+
var content = await downloadResponse.GetContentAsStringAsync();
114+
Assert.AreEqual("abc", content);
115+
var response = downloadResponse.Response;
116+
Assert.AreEqual(response.Name, "Foo.txt");
117+
Assert.AreEqual(response.PathLower, "/foo.txt");
118+
Assert.AreEqual(response.PathDisplay, "/Foo.txt");
119+
}
120+
121+
/// <summary>
122+
/// Converts string to a memory stream.
123+
/// </summary>
124+
/// <param name="content">The string content.</param>
125+
/// <returns>The memory stream.</returns>
126+
private static MemoryStream GetStream(string content)
127+
{
128+
var buffer = Encoding.UTF8.GetBytes(content);
129+
return new MemoryStream(buffer);
130+
}
131+
}
132+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("Dropbox.Api.Tests")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("Dropbox.Api.Tests")]
13+
[assembly: AssemblyCopyright("Copyright © 2016")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("5193572e-17f4-46b6-9a5b-e2bb316e408d")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RunSettings>
3+
<TestRunParameters>
4+
<Parameter name="accessToken" value="" />
5+
</TestRunParameters>
6+
</RunSettings>

Dropbox.Api.sln

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dropbox.Api", "Dropbox.Api\
2020
EndProject
2121
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleBusinessDashboard", "Examples\SimpleBusinessDashboard\SimpleBusinessDashboard.csproj", "{B762DE35-E606-4B57-8860-1A662DF5624C}"
2222
EndProject
23+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dropbox.Api.Tests", "Dropbox.Api.Tests\Dropbox.Api.Tests.csproj", "{0FDF769B-43F8-4907-98D5-A413BD9DE62D}"
24+
EndProject
2325
Global
2426
GlobalSection(SharedMSBuildProjectFiles) = preSolution
2527
Examples\UniversalDemo\UniversalDemo\UniversalDemo.Shared\UniversalDemo.Shared.projitems*{51d9899c-31d6-4c22-b894-e9498cb90577}*SharedItemsImports = 4
@@ -141,6 +143,16 @@ Global
141143
{B762DE35-E606-4B57-8860-1A662DF5624C}.Release|ARM.ActiveCfg = Release|Any CPU
142144
{B762DE35-E606-4B57-8860-1A662DF5624C}.Release|x64.ActiveCfg = Release|Any CPU
143145
{B762DE35-E606-4B57-8860-1A662DF5624C}.Release|x86.ActiveCfg = Release|Any CPU
146+
{0FDF769B-43F8-4907-98D5-A413BD9DE62D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
147+
{0FDF769B-43F8-4907-98D5-A413BD9DE62D}.Debug|Any CPU.Build.0 = Debug|Any CPU
148+
{0FDF769B-43F8-4907-98D5-A413BD9DE62D}.Debug|ARM.ActiveCfg = Debug|Any CPU
149+
{0FDF769B-43F8-4907-98D5-A413BD9DE62D}.Debug|x64.ActiveCfg = Debug|Any CPU
150+
{0FDF769B-43F8-4907-98D5-A413BD9DE62D}.Debug|x86.ActiveCfg = Debug|Any CPU
151+
{0FDF769B-43F8-4907-98D5-A413BD9DE62D}.Release|Any CPU.ActiveCfg = Release|Any CPU
152+
{0FDF769B-43F8-4907-98D5-A413BD9DE62D}.Release|Any CPU.Build.0 = Release|Any CPU
153+
{0FDF769B-43F8-4907-98D5-A413BD9DE62D}.Release|ARM.ActiveCfg = Release|Any CPU
154+
{0FDF769B-43F8-4907-98D5-A413BD9DE62D}.Release|x64.ActiveCfg = Release|Any CPU
155+
{0FDF769B-43F8-4907-98D5-A413BD9DE62D}.Release|x86.ActiveCfg = Release|Any CPU
144156
EndGlobalSection
145157
GlobalSection(SolutionProperties) = preSolution
146158
HideSolutionNode = FALSE

Dropbox.Api/Auth/AuthRoutes.cs renamed to Dropbox.Api/Auth/AuthUserRoutes.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ namespace Dropbox.Api.Auth.Routes
1313
/// <summary>
1414
/// <para>The routes for the <see cref="N:Dropbox.Api.Auth"/> namespace</para>
1515
/// </summary>
16-
public class AuthRoutes
16+
public class AuthUserRoutes
1717
{
1818
/// <summary>
19-
/// <para>Initializes a new instance of the <see cref="AuthRoutes" /> class.</para>
19+
/// <para>Initializes a new instance of the <see cref="AuthUserRoutes" /> class.</para>
2020
/// </summary>
2121
/// <param name="transport">The transport to use</param>
22-
internal AuthRoutes(enc.ITransport transport)
22+
internal AuthUserRoutes(enc.ITransport transport)
2323
{
2424
this.Transport = transport;
2525
}

Dropbox.Api/Dropbox.Api.Portable.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<Compile Include="Async\PollResultBase.cs" />
7676
<Compile Include="AuthException.cs" />
7777
<Compile Include="Auth\AuthError.cs" />
78-
<Compile Include="Auth\AuthRoutes.cs" />
78+
<Compile Include="Auth\AuthUserRoutes.cs" />
7979
<Compile Include="Auth\RateLimitError.cs" />
8080
<Compile Include="Auth\RateLimitReason.cs" />
8181
<Compile Include="DropboxClient.cs" />
@@ -95,7 +95,7 @@
9595
<Compile Include="Files\DownloadError.cs" />
9696
<Compile Include="Files\FileMetadata.cs" />
9797
<Compile Include="Files\FileSharingInfo.cs" />
98-
<Compile Include="Files\FilesRoutes.cs" />
98+
<Compile Include="Files\FilesUserRoutes.cs" />
9999
<Compile Include="Files\FolderMetadata.cs" />
100100
<Compile Include="Files\FolderSharingInfo.cs" />
101101
<Compile Include="Files\GetCopyReferenceArg.cs" />
@@ -302,8 +302,8 @@
302302
<Compile Include="Sharing\SharedLinkSettings.cs" />
303303
<Compile Include="Sharing\SharedLinkSettingsError.cs" />
304304
<Compile Include="Sharing\SharingFileAccessError.cs" />
305-
<Compile Include="Sharing\SharingRoutes.cs" />
306305
<Compile Include="Sharing\SharingUserError.cs" />
306+
<Compile Include="Sharing\SharingUserRoutes.cs" />
307307
<Compile Include="Sharing\TeamMemberInfo.cs" />
308308
<Compile Include="Sharing\TransferFolderArg.cs" />
309309
<Compile Include="Sharing\TransferFolderError.cs" />
@@ -453,7 +453,7 @@
453453
<Compile Include="Team\TeamMemberProfile.cs" />
454454
<Compile Include="Team\TeamMemberStatus.cs" />
455455
<Compile Include="Team\TeamMembershipType.cs" />
456-
<Compile Include="Team\TeamRoutes.cs" />
456+
<Compile Include="Team\TeamTeamRoutes.cs" />
457457
<Compile Include="Team\UpdatePropertyTemplateArg.cs" />
458458
<Compile Include="Team\UpdatePropertyTemplateResult.cs" />
459459
<Compile Include="Team\UserSelectorArg.cs" />
@@ -474,7 +474,7 @@
474474
<Compile Include="Users\SpaceUsage.cs" />
475475
<Compile Include="Users\Team.cs" />
476476
<Compile Include="Users\TeamSpaceAllocation.cs" />
477-
<Compile Include="Users\UsersRoutes.cs" />
477+
<Compile Include="Users\UsersUserRoutes.cs" />
478478
</ItemGroup>
479479
<ItemGroup>
480480
<None Include="packages.Dropbox.Api.Portable.config" />

0 commit comments

Comments
 (0)