forked from samus/mongodb-csharp
/
MongoConfigurationBuilderTests.cs
46 lines (39 loc) · 1.11 KB
/
MongoConfigurationBuilderTests.cs
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
using System;
using MongoDB.Configuration;
using NUnit.Framework;
namespace MongoDB.UnitTests.Configuration
{
[TestFixture]
public class MongoConfigurationBuilderTests
{
private class Person
{
public Guid Id { get; set; }
public int Age { get; set; }
public string Name { get; set; }
}
[Test]
public void Test()
{
var configure = new MongoConfigurationBuilder();
configure.ConnectionString(cs =>
{
cs.Pooled = true;
});
configure.Mapping(mapping =>
{
mapping.DefaultProfile(p =>
{
p.AliasesAreCamelCased();
p.CollectionNamesAreCamelCasedAndPlural();
});
mapping.Map<Person>(m =>
{
m.CollectionName("people");
m.Member(x => x.Age).Alias("age");
m.Member(x => x.Name).Alias("name").DefaultValue("something").Ignore();
});
});
}
}
}