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
14 changes: 6 additions & 8 deletions src/DocumentDB.AspNet.Identity.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Documents.Client, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Azure.DocumentDB.1.8.0\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
<Private>True</Private>
<Reference Include="Microsoft.Azure.Documents.Client, Version=1.21.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Azure.DocumentDB.1.21.1\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -72,9 +70,9 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Error Condition="!Exists('packages\Microsoft.Azure.DocumentDB.1.8.0\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Azure.DocumentDB.1.8.0\build\Microsoft.Azure.DocumentDB.targets'))" />
<Error Condition="!Exists('packages\Microsoft.Azure.DocumentDB.1.21.1\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Azure.DocumentDB.1.21.1\build\Microsoft.Azure.DocumentDB.targets'))" />
</Target>
<Import Project="packages\Microsoft.Azure.DocumentDB.1.8.0\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('packages\Microsoft.Azure.DocumentDB.1.8.0\build\Microsoft.Azure.DocumentDB.targets')" />
<Import Project="packages\Microsoft.Azure.DocumentDB.1.21.1\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('packages\Microsoft.Azure.DocumentDB.1.21.1\build\Microsoft.Azure.DocumentDB.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">
Expand Down
42 changes: 21 additions & 21 deletions src/Tests/TestBase.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
using System;
using Microsoft.Azure.Documents.Client;
using Microsoft.Azure.Documents.Client;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace Tests
{
public abstract class TestBase
{
protected DocumentClient Client;
public abstract class TestBase
{
protected DocumentClient Client;

protected readonly string Endpoint = "";
protected readonly string Key = "";
protected readonly string Database = "test";
protected readonly string Collection = "test";
protected readonly string Endpoint = "https://localhost:8081/";
protected readonly string Key = "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==";
protected readonly string Database = "test";
protected readonly string Collection = "test";

[TestInitialize]
public void Init()
{
Client = new DocumentClient(new Uri(Endpoint), Key);
}
[TestInitialize]
public void Init()
{
Client = new DocumentClient(new Uri(Endpoint), Key);
}

[TestCleanup]
public void Cleanup()
{
Client.DeleteDatabaseAsync(UriFactory.CreateDatabaseUri(Database)).Wait();
Client.Dispose();
}
}
[TestCleanup]
public void Cleanup()
{
Client.DeleteDatabaseAsync(UriFactory.CreateDatabaseUri(Database)).Wait();
Client.Dispose();
}
}
}
14 changes: 6 additions & 8 deletions src/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,11 @@
<Reference Include="Microsoft.AspNet.Identity.Core">
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Documents.Client, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Azure.DocumentDB.1.8.0\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
<Private>True</Private>
<Reference Include="Microsoft.Azure.Documents.Client, Version=1.21.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Azure.DocumentDB.1.21.1\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
</ItemGroup>
Expand Down Expand Up @@ -108,9 +106,9 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Azure.DocumentDB.1.8.0\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Azure.DocumentDB.1.8.0\build\Microsoft.Azure.DocumentDB.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Azure.DocumentDB.1.21.1\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Azure.DocumentDB.1.21.1\build\Microsoft.Azure.DocumentDB.targets'))" />
</Target>
<Import Project="..\packages\Microsoft.Azure.DocumentDB.1.8.0\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('..\packages\Microsoft.Azure.DocumentDB.1.8.0\build\Microsoft.Azure.DocumentDB.targets')" />
<Import Project="..\packages\Microsoft.Azure.DocumentDB.1.21.1\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('..\packages\Microsoft.Azure.DocumentDB.1.21.1\build\Microsoft.Azure.DocumentDB.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">
Expand Down
104 changes: 52 additions & 52 deletions src/Tests/Tests/CustomUserPropertiesTests.cs
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
using System;
using System.Threading.Tasks;
using DocumentDB.AspNet.Identity;
using DocumentDB.AspNet.Identity;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Threading.Tasks;

namespace Tests.Tests
{
[TestClass]
public class CustomUserPropertiesTests : TestBase
{
private readonly UserStore<TestUserType> _userStore;
[TestClass]
public class CustomUserPropertiesTests : TestBase
{
private readonly UserStore<TestUserType> _userStore;

public CustomUserPropertiesTests()
{
Init();
_userStore = new UserStore<TestUserType>(Client, Database, Collection, true);
}
public CustomUserPropertiesTests()
{
Init();
_userStore = new UserStore<TestUserType>(Client, Database, Collection, true);
}

private TestUserType _testUser = new TestUserType
{
UserName = "customtest@test.com",
Email = "customtest@test.com",
IsAwesome = true,
TestTest = "this just some some text..."
};
private TestUserType _testUser = new TestUserType
{
UserName = "customtest@test.com",
Email = "customtest@test.com",
IsAwesome = true,
TestTest = "this just some some text..."
};

[TestMethod]
public async Task CanCreateUserWithCustomProperties()
{
await _userStore.CreateAsync(_testUser);
[TestMethod]
public async Task CanCreateUserWithCustomProperties()
{
await _userStore.CreateAsync(_testUser);

var savedUser = await _userStore.FindByEmailAsync(_testUser.Email);
var savedUser = await _userStore.FindByEmailAsync(_testUser.Email);

Assert.IsNotNull(savedUser);
Assert.IsTrue(savedUser.IsAwesome);
Assert.IsFalse(string.IsNullOrEmpty(savedUser.TestTest));
Assert.AreEqual(_testUser.Email, savedUser.Email);
}
Assert.IsNotNull(savedUser);
Assert.IsTrue(savedUser.IsAwesome);
Assert.IsFalse(string.IsNullOrEmpty(savedUser.TestTest));
Assert.AreEqual(_testUser.Email, savedUser.Email);
}

[TestMethod]
public async Task UpdatesAreAppliedToUserWithCustomProperties()
{
await CanCreateUserWithCustomProperties();
[TestMethod]
public async Task UpdatesAreAppliedToUserWithCustomProperties()
{
await CanCreateUserWithCustomProperties();

var savedUser = await _userStore.FindByEmailAsync(_testUser.Email);
if (savedUser == null)
{
throw new NullReferenceException("savedUser");
}
var savedUser = await _userStore.FindByEmailAsync(_testUser.Email);
if (savedUser == null)
{
throw new NullReferenceException("savedUser");
}

savedUser.IsAwesome = false;
savedUser.TestTest = "test test text";
savedUser.IsAwesome = false;
savedUser.TestTest = "test test text";

await _userStore.UpdateAsync(savedUser);
await _userStore.UpdateAsync(savedUser);

savedUser = await _userStore.FindByEmailAsync(_testUser.Email);
savedUser = await _userStore.FindByEmailAsync(_testUser.Email);

Assert.IsNotNull(savedUser);
Assert.IsFalse(savedUser.IsAwesome);
Assert.AreSame(savedUser.TestTest, "test test text");
}
}
Assert.IsNotNull(savedUser);
Assert.IsFalse(savedUser.IsAwesome);
Assert.AreEqual(savedUser.TestTest, "test test text");
}
}

public class TestUserType : IdentityUser
{
public bool IsAwesome { get; set; }
public string TestTest { get; set; }
}
public class TestUserType : IdentityUser
{
public bool IsAwesome { get; set; }
public string TestTest { get; set; }
}
}
2 changes: 1 addition & 1 deletion src/Tests/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
4 changes: 2 additions & 2 deletions src/Tests/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net45" />
<package id="Microsoft.Azure.DocumentDB" version="1.8.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
<package id="Microsoft.Azure.DocumentDB" version="1.21.1" targetFramework="net45" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net45" />
</packages>
2 changes: 1 addition & 1 deletion src/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
4 changes: 2 additions & 2 deletions src/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net45" />
<package id="Microsoft.Azure.DocumentDB" version="1.8.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
<package id="Microsoft.Azure.DocumentDB" version="1.21.1" targetFramework="net45" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net45" />
</packages>