Permalink
Browse files

Merge branch 'henrik'

  • Loading branch information...
2 parents b2242f2 + 0f7f1df commit 3fa068029ec2cf39ccdd4ebccb2fdc10e1641a81 @gokr gokr committed Sep 22, 2009
View
12 Divan.sln
@@ -5,6 +5,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divan", "src\Divan.csproj",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Trivial", "samples\Trivial\Trivial.csproj", "{CDCC7924-F227-46DC-B2E6-2BBE06B84AF2}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divan.Test", "Tests\Divan.Test.csproj", "{09FB3192-8F25-4112-A8BB-93C83F6C3DDD}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -19,12 +21,16 @@ Global
{CDCC7924-F227-46DC-B2E6-2BBE06B84AF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CDCC7924-F227-46DC-B2E6-2BBE06B84AF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CDCC7924-F227-46DC-B2E6-2BBE06B84AF2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {09FB3192-8F25-4112-A8BB-93C83F6C3DDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {09FB3192-8F25-4112-A8BB-93C83F6C3DDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {09FB3192-8F25-4112-A8BB-93C83F6C3DDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {09FB3192-8F25-4112-A8BB-93C83F6C3DDD}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
version = 0.1
StartupItem = src\Divan.csproj
EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
EndGlobal
View
7 Tests/App.config
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <appSettings>
+ <add key="CouchHost" value="localhost" />
+ <add key="CouchPort" value="5984" />
+ </appSettings>
+</configuration>
View
13 src/CouchTest.cs → Tests/CouchTest.cs
@@ -1,12 +1,13 @@
using System;
using System.Collections.Generic;
+using System.Configuration;
using System.Linq;
using System.Text.RegularExpressions;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
-namespace Divan
+namespace Divan.Test
{
/// <summary>
/// Unit tests for Divan. Operates in a separate CouchDB database called divan_unit_tests.
@@ -21,7 +22,9 @@ public class CouchTest
[SetUp]
public void SetUp()
{
- server = new CouchServer();
+ var host = ConfigurationManager.AppSettings["CouchHost"];
+ var port = Convert.ToInt32(ConfigurationManager.AppSettings["CouchPort"]);
+ server = new CouchServer(host, port);
db = server.GetNewDatabase(DbName);
}
@@ -222,7 +225,7 @@ public void ShouldUseETagForView()
{
var design = db.NewDesignDocument("computers");
design.AddView("by_cpumake",
- @"function(doc) {
+ @"function(doc) {
emit(doc.CPU, doc);
}");
db.WriteDocument(design);
@@ -265,15 +268,15 @@ public void ShouldSyncDesignDocuments()
{
var design = db.NewDesignDocument("computers");
design.AddView("by_cpumake",
- @"function(doc) {
+ @"function(doc) {
emit(doc.CPU, doc);
}");
db.SynchDesignDocuments(); // This writes them to the db.
var db2 = server.GetDatabase(DbName);
design = db2.NewDesignDocument("computers");
design.AddView("by_cpumake",
- @"function(doc) {
+ @"function(doc) {
emit(doc.CPU, nil);
}");
db2.SynchDesignDocuments(); // This should detect difference and overwrite the one in the db
View
78 Tests/Divan.Test.csproj
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{09FB3192-8F25-4112-A8BB-93C83F6C3DDD}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Divan.Test</RootNamespace>
+ <AssemblyName>Divan.Test</AssemblyName>
+ <TargetFrameworkVersion>v3.5</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="Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\lib\Newtonsoft.Json.dll</HintPath>
+ </Reference>
+ <Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\lib\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.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="CouchTest.cs" />
+ <Compile Include="Lucene\CouchLuceneTest.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\src\Divan.csproj">
+ <Project>{37AC0B66-5340-4B81-BC62-3EE80233A011}</Project>
+ <Name>Divan</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.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>
View
12 src/Lucene/CouchLuceneTest.cs → Tests/Lucene/CouchLuceneTest.cs
@@ -1,10 +1,12 @@
+using System;
+using System.Configuration;
using System.Linq;
using System.Threading;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
-namespace Divan.Lucene
+namespace Divan.Test.Lucene
{
/// <summary>
/// Unit tests for the Lucene part in Divan. Operates in a separate CouchDB database called divan_lucene_unit_tests.
@@ -20,7 +22,9 @@ public class CouchLuceneTest
[SetUp]
public void SetUp()
{
- server = new CouchServer();
+ var host = ConfigurationManager.AppSettings["CouchHost"];
+ var port = Convert.ToInt32(ConfigurationManager.AppSettings["CouchPort"]);
+ server = new CouchServer(host, port);
db = server.GetNewDatabase(DbName);
}
@@ -61,9 +65,9 @@ public void ShouldHandleTrivialQuery()
Assert.That(hits.First().Id(), Is.EqualTo("my-funky-id"));
// Then we should be able to GetDocuments() which will perform a bulk get
- var doc = result.GetDocuments<CouchJsonDocument>().First();
+ var doc = result.GetDocuments<CouchJsonDocument>().First();
Assert.That(doc.Id, Is.EqualTo("my-funky-id"));
- Assert.That(doc.Obj["text"].Value<string>(), Is.EqualTo("one two three four"));
+ Assert.That(doc.Obj["text"].Value<string>(), Is.EqualTo("one two three four"));
// Then all over again but including documents and getting it out in one single query.
result = view.Query().Q("one").IncludeDocuments().GetResult();
View
36 Tests/Properties/AssemblyInfo.cs
@@ -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("Divan.Test")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("Divan.Test")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
+[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("0a9ad2f5-d314-4878-a082-e05836823e42")]
+
+// 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
11 src/Divan.csproj
@@ -1,9 +1,9 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.30729</ProductVersion>
+ <ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{37AC0B66-5340-4B81-BC62-3EE80233A011}</ProjectGuid>
<OutputType>Library</OutputType>
@@ -35,10 +35,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\lib\Newtonsoft.Json.dll</HintPath>
</Reference>
- <Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\lib\nunit.framework.dll</HintPath>
- </Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -61,7 +57,6 @@
<Compile Include="CouchQueryDocument.cs" />
<Compile Include="CouchRequest.cs" />
<Compile Include="CouchServer.cs" />
- <Compile Include="CouchTest.cs" />
<Compile Include="CouchViewDefinitionBase.cs" />
<Compile Include="CouchViewResult.cs" />
<Compile Include="CouchViewDefinition.cs" />
@@ -75,7 +70,6 @@
<Compile Include="Linq\ExpressionVisitor.cs" />
<Compile Include="Linq\TypeSystem.cs" />
<Compile Include="Lucene\CouchLuceneQuery.cs" />
- <Compile Include="Lucene\CouchLuceneTest.cs" />
<Compile Include="Lucene\CouchLuceneViewDefinition.cs" />
<Compile Include="Lucene\CouchLuceneViewResult.cs" />
</ItemGroup>
@@ -101,5 +95,6 @@
</MonoDevelop.Autotools.MakefileInfo>
</Properties>
</MonoDevelop>
+ <VisualStudio />
</ProjectExtensions>
</Project>

0 comments on commit 3fa0680

Please sign in to comment.