Permalink
Browse files

Merge branch 'master' of github.com:soitgoes/LoveSeat

  • Loading branch information...
2 parents 63e21c7 + 5dbed2c commit 82a1655af7592fa49f4fc6555cbb23fddda43502 @soitgoes committed Aug 11, 2013
Binary file not shown.
@@ -20,12 +20,12 @@ public class CouchClientTest
private const string baseDatabase = "love-seat-test-base";
private const string replicateDatabase = "love-seat-test-repli";
- private readonly string host = ConfigurationManager.AppSettings["Host"].ToString();
- private readonly int port = int.Parse(ConfigurationManager.AppSettings["Port"].ToString());
- private readonly string username = ConfigurationManager.AppSettings["UserName"].ToString();
- private readonly string password = ConfigurationManager.AppSettings["Password"].ToString();
+ private readonly string host = ConfigurationManager.AppSettings["Host"];
+ private readonly int port = int.Parse(ConfigurationManager.AppSettings["Port"]);
+ private readonly string username = ConfigurationManager.AppSettings["UserName"];
+ private readonly string password = ConfigurationManager.AppSettings["Password"];
- [TestFixtureSetUp]
+ [SetUp]
public void Setup()
{
client = new CouchClient(host, port, username, password, false,AuthenticationType.Cookie);
@@ -38,7 +38,7 @@ public void Setup()
client.CreateDatabase(replicateDatabase);
}
}
- [TestFixtureTearDown]
+ [TearDown]
public void TearDown()
{
//delete the test database
@@ -219,6 +219,45 @@ public void Should_Get_Id_From_Existing_Document()
Document doc= db.GetDocument(id);
Assert.AreEqual(id, doc.Id);
}
+
+ [Test]
+ public void Should_Populate_Items_When_IncludeDocs_Set_In_ViewOptions()
+ {
+ string designDoc = "test";
+ string viewName = "testView";
+ var settings = new JsonSerializerSettings();
+ var converters = new List<JsonConverter> { new IsoDateTimeConverter() };
+ settings.Converters = converters;
+ settings.ContractResolver = new CamelCasePropertyNamesContractResolver();
+ settings.NullValueHandling = NullValueHandling.Ignore;
+
+ var doc = new
+ {
+ _id = "_design/" + designDoc,
+ Language = "javascript",
+ Views = new
+ {
+ TestView = new
+ {
+ Map = "function(doc) {\n if(doc.type == 'company') {\n emit(doc._id, null);\n }\n}"
+ }
+ }
+ };
+
+ var db = client.GetDatabase(baseDatabase);
+ db.CreateDocument(doc._id, JsonConvert.SerializeObject(doc, Formatting.Indented, settings));
+
+ var company = new Company();
+ company.Name = "foo";
+ db.CreateDocument(company);
+
+ // Without IncludeDocs
+ Assert.IsNull(db.View<Company>(viewName, designDoc).Items.ToList()[0]);
+
+ // With IncludeDocs
+ ViewOptions options = new ViewOptions { IncludeDocs = true };
+ Assert.AreEqual("foo", db.View<Company>(viewName, options, designDoc).Items.ToList()[0].Name);
+ }
}
public class Company : IBaseObject
{
View
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoveSeat.Monodroid", "LoveSeat.Monodroid\LoveSeat.Monodroid.csproj", "{01D175EC-4BEE-4B81-88AA-CF28395D68D0}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {01D175EC-4BEE-4B81-88AA-CF28395D68D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {01D175EC-4BEE-4B81-88AA-CF28395D68D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {01D175EC-4BEE-4B81-88AA-CF28395D68D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {01D175EC-4BEE-4B81-88AA-CF28395D68D0}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using Android.App;
+using Android.Content;
+using Android.OS;
+using Android.Runtime;
+using Android.Views;
+using Android.Widget;
+
+namespace LoveSeat.Support
+{
+ public class HttpException : Exception
+ {
+ public HttpException(string error)
+ : base(error)
+ {}
+ }
+}
@@ -0,0 +1,142 @@
+<?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>{01D175EC-4BEE-4B81-88AA-CF28395D68D0}</ProjectGuid>
+ <ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>LoveSeat.Monodroid</RootNamespace>
+ <AssemblyName>LoveSeat.Monodroid</AssemblyName>
+ <FileAlignment>512</FileAlignment>
+ <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
+ </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="Mono.Android" />
+ <Reference Include="mscorlib" />
+ <Reference Include="Newtonsoft.Json.MonoDroid">
+ <HintPath>..\Libraries\Newtonsoft.Json.MonoDroid.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Web.Services" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\LoveSeat.Interfaces\IAuditableRecord.cs">
+ <Link>Interfaces\IAuditableRecord.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat.Interfaces\IBaseObject.cs">
+ <Link>Interfaces\IBaseObject.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat.Interfaces\IRepository.cs">
+ <Link>Interfaces\IRepository.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\CouchClient.cs">
+ <Link>CouchClient.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\CouchConfiguration.cs">
+ <Link>CouchConfiguration.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\CouchDatabase.cs">
+ <Link>CouchDatabase.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\CouchException.cs">
+ <Link>CouchException.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\CouchResponse.cs">
+ <Link>CouchResponse.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\CouchUser.cs">
+ <Link>CouchUser.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\Document.cs">
+ <Link>Document.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\Interfaces\IDocumentDatabase.cs">
+ <Link>Interfaces\IDocumentDatabase.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\Interfaces\IKeyOptions.cs">
+ <Link>Interfaces\IKeyOptions.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\Interfaces\IListResult.cs">
+ <Link>Interfaces\IListResult.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\Interfaces\IViewOptions.cs">
+ <Link>Interfaces\IViewOptions.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\Interfaces\IViewResult.cs">
+ <Link>Interfaces\IViewResult.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\ListResult.cs">
+ <Link>ListResult.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\ObjectSerializer.cs">
+ <Link>ObjectSerializer.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\PagingHelper.cs">
+ <Link>PagingHelper.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\SecurityUtility.cs">
+ <Link>SecurityUtility.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\Support\CouchBase.cs">
+ <Link>Support\CouchBase.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\Support\CouchRequest.cs">
+ <Link>Support\CouchRequest.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\Support\KeyOptions.cs">
+ <Link>Support\KeyOptions.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\Support\NullableDictionary.cs">
+ <Link>Support\NullableDictionary.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\Support\ReplicationOptions.cs">
+ <Link>Support\ReplicationOptions.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\Support\ResponseExtensionMethods.cs">
+ <Link>Support\ResponseExtensionMethods.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\Support\TtlDictionary.cs">
+ <Link>Support\TtlDictionary.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\ViewOptions.cs">
+ <Link>ViewOptions.cs</Link>
+ </Compile>
+ <Compile Include="..\LoveSeat\ViewResult.cs">
+ <Link>ViewResult.cs</Link>
+ </Compile>
+ <Compile Include="HttpException.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.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>
@@ -0,0 +1,29 @@
+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("LoveSeat.Monodroid")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("LoveSeat.Monodroid")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: ComVisible(false)]
+
+// 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")]
View
@@ -167,8 +167,7 @@ public void DeleteAdminUser(string userToDelete)
/// <param name="databaseName"></param>
/// <returns></returns>
public bool HasDatabase(string databaseName) {
- var request = GetRequest(baseUri + databaseName);
- request.Timeout = -1;
+ var request = GetRequest(baseUri + databaseName).Timeout(-1);
var response = request.GetResponse();
var pDocResult = new Document(response.GetResponseString());
Oops, something went wrong.

0 comments on commit 82a1655

Please sign in to comment.