forked from ThatRendle/Simple.Data
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdapterFactoryTest.cs
More file actions
90 lines (76 loc) · 2.63 KB
/
AdapterFactoryTest.cs
File metadata and controls
90 lines (76 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
namespace Simple.Data.UnitTest
{
using System;
using System.Collections.Generic;
using NUnit.Framework;
[TestFixture]
public class AdapterFactoryTest
{
private static AdapterFactory CreateTarget()
{
return new CachingAdapterFactory(new StubComposer());
}
[Test]
[ExpectedException(typeof(ArgumentException))]
public void CreateWithAnonymousObjectWithoutConnectionStringThrowsArgumentException()
{
CreateTarget().Create(new { X = "" });
}
[Test]
public void CreateWithName()
{
var actual = CreateTarget().Create("Stub", null);
Assert.IsNotNull(actual);
}
}
class StubComposer : Composer
{
public override T Compose<T>()
{
return (T) Create();
}
public override T Compose<T>(string contractName)
{
return (T)Create();
}
private object Create()
{
return new StubAdapter();
}
}
class StubAdapter : Adapter
{
public override IEnumerable<IDictionary<string, object>> Find(string tableName, SimpleExpression criteria)
{
throw new NotImplementedException();
}
public override IEnumerable<IDictionary<string, object>> RunQuery(SimpleQuery query, out IEnumerable<SimpleQueryClauseBase> unhandledClauses)
{
throw new NotImplementedException();
}
public override IDictionary<string, object> Insert(string tableName, IDictionary<string, object> data)
{
throw new NotImplementedException();
}
public override int Update(string tableName, IDictionary<string, object> data, SimpleExpression criteria)
{
throw new NotImplementedException();
}
public override int Delete(string tableName, SimpleExpression criteria)
{
throw new NotImplementedException();
}
public override IEnumerable<IEnumerable<IDictionary<string, object>>> RunQueries(SimpleQuery[] queries, List<IEnumerable<SimpleQueryClauseBase>> unhandledClauses)
{
throw new NotImplementedException();
}
public override bool IsExpressionFunction(string functionName, params object[] args)
{
throw new NotImplementedException();
}
public override int Update(string tableName, IDictionary<string, object> data)
{
throw new NotImplementedException();
}
}
}