Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
98f8aac
response was not being closed so server was running out of connections
Ian1971 Apr 26, 2012
6e921c4
reverted a debugging aid I added into CouchRequest.cs, it is now as i…
Ian1971 Apr 26, 2012
5634418
response was not being closed so server was running out of connections
Ian1971 Apr 26, 2012
1f67047
reverted a debugging aid I added into CouchRequest.cs, it is now as i…
Ian1971 Apr 26, 2012
7f108b8
merge in latest changes from source
Ian1971 Oct 15, 2013
1708d16
Merge branch 'master' of github.com:Ian1971/LoveSeat
Ian1971 Oct 15, 2013
b579256
update json.net
Ian1971 Oct 15, 2013
16c1093
Update README.md
Ian1971 Oct 15, 2013
0755303
Update README.md
Ian1971 Oct 15, 2013
71fb36e
Fix for isAtKeysSizeLimit always returning false
Ian1971 Oct 18, 2013
fec079a
Merge branch 'master' of github.com:Ian1971/LoveSeat
Ian1971 Oct 18, 2013
340a5c9
add SetPermissions support
Ian1971 Oct 21, 2013
7e0ccb7
add missing file
Ian1971 Oct 22, 2013
198e089
add virtual to some methods
Ian1971 Oct 22, 2013
4f71e9f
more methods to virtual for mocking
Ian1971 Oct 23, 2013
7cedd6f
logging in couchrequest
Ian1971 Jan 15, 2014
6613976
Update netwonsoft.json, log4net
Ian1971 Apr 29, 2014
031703a
Add support for cloudant generateapikey
Ian1971 Jul 17, 2014
cac5fc7
Allows setting custom IObjectSerializer for CouchDatabase
kwokhou Jul 17, 2014
1091987
Merge remote-tracking branch 'upstream/master'
Ian1971 Oct 15, 2014
538d21e
Make cookie handling thread safe so CouchDatabase can be used on mult…
Ian1971 Oct 15, 2014
45797ee
change to cloudant api v2 for api key gen.
Ian1971 Nov 18, 2014
db5f14a
ViewResult.Docs was always empty
Ian1971 Jan 20, 2015
cfccb1d
increase default timeout as sessions taking a long time
Ian1971 Jun 22, 2015
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
Binary file added Libraries/Moq.AutoMock.dll
Binary file not shown.
27 changes: 18 additions & 9 deletions LoveSeat.IntegrationTest/App.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Host" value="localhost"/>
<add key="Port" value="5984"/>
<add key="UserName" value="Professor" />
<add key="Password" value="Farnsworth"/>
</appSettings>
</configuration>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="Host" value="localhost" />
<add key="Port" value="5984" />
<add key="UserName" value="Professor" />
<add key="Password" value="Farnsworth" />
</appSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Moq" publicKeyToken="69f491c39445e920" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.1409.1722" newVersion="4.2.1409.1722" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
49 changes: 44 additions & 5 deletions LoveSeat.IntegrationTest/CouchClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Linq;
using System.Management.Instrumentation;
using System.Net;
using LoveSeat.Interfaces;
using LoveSeat.Support;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
Expand All @@ -26,9 +28,18 @@ public class CouchClientTest
private readonly string password = ConfigurationManager.AppSettings["Password"];

[SetUp]
public void Setup()
{
client = new CouchClient(host, port, username, password, false,AuthenticationType.Cookie);
public void Setup()
{
var connection = new CouchConnection()
{
Username = username,
Password = password,
AuthenticationType = AuthenticationType.Cookie,
DbType = DbType.CouchDb,
DatabaseName = baseDatabase
};
connection.ConfigureBaseUri(host, port, false);
client = new CouchClient(connection);
if (!client.HasDatabase(baseDatabase))
{
client.CreateDatabase(baseDatabase);
Expand Down Expand Up @@ -208,7 +219,7 @@ public void Should_Get_304_If_ETag_Matches()
db.CreateDocument(@"{""_id"":""test_eTag_exception""}");
ViewResult result = db.GetAllDocuments();
ViewResult cachedResult = db.GetAllDocuments(new ViewOptions {Etag = result.Etag});
Assert.AreEqual(cachedResult.StatusCode, HttpStatusCode.NotModified);
Assert.AreEqual(HttpStatusCode.NotModified, cachedResult.StatusCode);
}
[Test]
public void Should_Get_Id_From_Existing_Document()
Expand Down Expand Up @@ -257,6 +268,34 @@ public void Should_Populate_Items_When_IncludeDocs_Set_In_ViewOptions()
// With IncludeDocs
ViewOptions options = new ViewOptions { IncludeDocs = true };
Assert.AreEqual("foo", db.View<Company>(viewName, options, designDoc).Items.ToList()[0].Name);
}

[Test]
public void Should_Use_Post_With_Many_Keys()
{
//this test ensures that request with lots of keys still work
//it should switch from get to post
var db = client.GetDatabase(baseDatabase);

var docIds = new HashSet<string>();
//create 1000 documents
for (int i = 0; i < 1000; i++)
{
var doc = new Document<Bunny>(new Bunny());
doc.Id = Guid.NewGuid().ToString();

db.CreateDocument(doc);

docIds.Add(doc.Id);
}

var keys = new Keys();
keys.Values.AddRange(docIds);

var docs = db.GetDocuments(keys);
Assert.IsNotNull(docs, "Should be able to get many docs");

Assert.AreEqual(1000, docs.Keys.Count());
}
}
public class Company : IBaseObject
Expand Down
198 changes: 110 additions & 88 deletions LoveSeat.IntegrationTest/LoveSeat.IntegrationTest.csproj
Original file line number Diff line number Diff line change
@@ -1,89 +1,111 @@
<?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>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{7496CEA9-442C-4468-8350-54F34693F64A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LoveSeat.IntegrationTest</RootNamespace>
<AssemblyName>LoveSeat.IntegrationTest</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
</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>
<PlatformTarget>x86</PlatformTarget>
</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="Moq">
<HintPath>..\Libraries\Moq\Moq.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Libraries\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CouchClientTest.cs" />
<Compile Include="NewtonSoftTests.cs" />
<Compile Include="PagingHelperTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LoveSeat.Interfaces\LoveSeat.Interfaces.csproj">
<Project>{18833FC5-9145-451D-82D4-41A1886B0BE7}</Project>
<Name>LoveSeat.Interfaces</Name>
</ProjectReference>
<ProjectReference Include="..\LoveSeat\LoveSeat.csproj">
<Project>{AF987164-0100-4A90-A767-D473F882EA8B}</Project>
<Name>LoveSeat</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="Files\martin.jpg" />
<Content Include="Files\test_upload.txt" />
</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>
-->
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{7496CEA9-442C-4468-8350-54F34693F64A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LoveSeat.IntegrationTest</RootNamespace>
<AssemblyName>LoveSeat.IntegrationTest</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<TargetFrameworkProfile />
</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>
<PlatformTarget>x86</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</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>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentAssertions, Version=3.2.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\FluentAssertions.3.2.1\lib\net45\FluentAssertions.dll</HintPath>
</Reference>
<Reference Include="FluentAssertions.Core, Version=3.2.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\FluentAssertions.3.2.1\lib\net45\FluentAssertions.Core.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.2.1409.1722, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Moq.4.2.1409.1722\lib\net40\Moq.dll</HintPath>
</Reference>
<Reference Include="Moq.AutoMock, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Libraries\Moq.AutoMock.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.6.0.6\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="CouchClientTest.cs" />
<Compile Include="Unit\CloudantDatabaseTest.cs" />
<Compile Include="NewtonSoftTests.cs" />
<Compile Include="PagingHelperTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Unit\UriExtensionsTest.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LoveSeat.Interfaces\LoveSeat.Interfaces.csproj">
<Project>{18833FC5-9145-451D-82D4-41A1886B0BE7}</Project>
<Name>LoveSeat.Interfaces</Name>
</ProjectReference>
<ProjectReference Include="..\LoveSeat\LoveSeat.csproj">
<Project>{AF987164-0100-4A90-A767-D473F882EA8B}</Project>
<Name>LoveSeat</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="Files\martin.jpg" />
<Content Include="Files\test_upload.txt" />
</ItemGroup>
<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>
Loading