Skip to content

Commit d710f4d

Browse files
committed
Db4o updates
1 parent 428747c commit d710f4d

30 files changed

Lines changed: 26322 additions & 2 deletions
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using System.IO;
3+
4+
namespace SharpRepository.Tests.Integration.Data
5+
{
6+
public class Db4oDataDirectoryFactory
7+
{
8+
private static int _num = 1;
9+
10+
public static string Build(string type)
11+
{
12+
var dataDirectory = DataDirectoryHelper.GetDataDirectory();
13+
string db4oPath = Path.Combine(dataDirectory, @"Db4o");
14+
15+
var file = String.Format("{0}\\{1}.yap", db4oPath, _num);
16+
_num++; // since it goes through and calls this for each test before running them, we need a different database for each test
17+
18+
19+
if (File.Exists(file)) { File.Delete(file); }
20+
21+
return file;
22+
}
23+
}
24+
}

SharpRepository.Tests.Integration/Data/RepositoryTestCaseDataFactory.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using NUnit.Framework;
66
using Raven.Client.Document;
77
using Raven.Client.Embedded;
8+
using SharpRepository.Db4o;
89
using SharpRepository.Repository;
910
using SharpRepository.Tests.Integration.TestObjects;
1011
using SharpRepository.XmlRepository;
@@ -37,6 +38,13 @@ public static IEnumerable<TestCaseData> Build(RepositoryTypes[] includeTypes)
3738
new TestCaseData(new EfRepository<Contact, int>(new TestObjectEntities("Data Source=" + dbPath))).SetName("EfRepository Test");
3839
}
3940

41+
if (includeTypes.Contains(RepositoryTypes.All) || includeTypes.Contains(RepositoryTypes.Dbo4))
42+
{
43+
var db4oPath = Db4oDataDirectoryFactory.Build("Contact");
44+
yield return
45+
new TestCaseData(new Db4oRepository<Contact, int>(db4oPath)).SetName("Db4oRepository Test");
46+
}
47+
4048
if (includeTypes.Contains(RepositoryTypes.All) || includeTypes.Contains(RepositoryTypes.RavenDb))
4149
{
4250
var documentStore = new EmbeddableDocumentStore

SharpRepository.Tests.Integration/RepositoryAddTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace SharpRepository.Tests.Integration
1212
[TestFixture]
1313
public class RepositoryAddTests : TestBase
1414
{
15-
[ExecuteForAllRepositories]
15+
[ExecuteForRepositories(RepositoryTypes.Dbo4)]
1616
public void Add_Should_Save_And_Assigned_New_Id(IRepository<Contact, int> repository)
1717
{
1818
var contact = new Contact { Name = "Test User" };

SharpRepository.Tests.Integration/RepositoryTypes.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ public enum RepositoryTypes
66
Xml,
77
InMemory,
88
Ef,
9-
RavenDb
9+
RavenDb,
10+
Dbo4
1011
}
1112
}

SharpRepository.Tests.Integration/SharpRepository.Tests.Integration.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
<Link>Properties\CommonAssembly.cs</Link>
114114
</Compile>
115115
<Compile Include="Data\DataDirectoryHelper.cs" />
116+
<Compile Include="Data\Db4oDataDirectoryFactory.cs" />
116117
<Compile Include="Data\EfDataDirectoryFactory.cs" />
117118
<Compile Include="Helpers\CurrentDirectory.cs" />
118119
<Compile Include="Spikes\RavenDbEmbeddedTests.cs" />
@@ -156,12 +157,17 @@
156157
<Project>{710DEE79-25CE-4F68-B8B1-D08A135AD154}</Project>
157158
<Name>SharpRepository.Repository</Name>
158159
</ProjectReference>
160+
<ProjectReference Include="..\SharpRepository.Sqlite\SharpRepository.Db4o.csproj">
161+
<Project>{12DD3830-5A12-484C-98B4-D30811DEC8A9}</Project>
162+
<Name>SharpRepository.Db4o</Name>
163+
</ProjectReference>
159164
<ProjectReference Include="..\SharpRepository.XmlRepository\SharpRepository.XmlRepository.csproj">
160165
<Project>{CA482895-A2F4-4C69-9D39-8AD1CFB1B877}</Project>
161166
<Name>SharpRepository.XmlRepository</Name>
162167
</ProjectReference>
163168
</ItemGroup>
164169
<ItemGroup>
170+
<Folder Include="Data\Db4o\" />
165171
<Folder Include="Data\Ef\" />
166172
<Folder Include="Data\Xml\" />
167173
</ItemGroup>

SharpRepository.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
3030
EndProject
3131
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpRepository.InMemoryRepository", "SharpRepository.InMemoryRepository\SharpRepository.InMemoryRepository.csproj", "{13AD3FCA-4C9D-4674-B786-F30843638D3B}"
3232
EndProject
33+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpRepository.Db4o", "SharpRepository.Sqlite\SharpRepository.Db4o.csproj", "{12DD3830-5A12-484C-98B4-D30811DEC8A9}"
34+
EndProject
3335
Global
3436
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3537
Debug|Any CPU = Debug|Any CPU
@@ -68,6 +70,10 @@ Global
6870
{13AD3FCA-4C9D-4674-B786-F30843638D3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
6971
{13AD3FCA-4C9D-4674-B786-F30843638D3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
7072
{13AD3FCA-4C9D-4674-B786-F30843638D3B}.Release|Any CPU.Build.0 = Release|Any CPU
73+
{12DD3830-5A12-484C-98B4-D30811DEC8A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
74+
{12DD3830-5A12-484C-98B4-D30811DEC8A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
75+
{12DD3830-5A12-484C-98B4-D30811DEC8A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
76+
{12DD3830-5A12-484C-98B4-D30811DEC8A9}.Release|Any CPU.Build.0 = Release|Any CPU
7177
EndGlobalSection
7278
GlobalSection(SolutionProperties) = preSolution
7379
HideSolutionNode = FALSE
2.21 MB
Binary file not shown.
Binary file not shown.
Binary file not shown.
740 KB
Binary file not shown.

0 commit comments

Comments
 (0)