Skip to content

Commit 9c96999

Browse files
committed
CSHARP-708: added breaking test.
1 parent 2235bee commit 9c96999

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/* Copyright 2010-2012 10gen Inc.
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
using MongoDB.Bson;
17+
using MongoDB.Bson.Serialization.Attributes;
18+
using NUnit.Framework;
19+
using MongoDB.Bson.Serialization;
20+
using MongoDB.Bson.Serialization.Conventions;
21+
22+
namespace MongoDB.BsonUnitTests.Jira.CSharp708
23+
{
24+
[TestFixture]
25+
public class CSharp708Tests
26+
{
27+
interface IIdentity
28+
{
29+
string Id { get; }
30+
}
31+
32+
class Entity : IIdentity
33+
{
34+
public string Id { get; set; }
35+
}
36+
37+
void ConfigureClassMap<T>(BsonClassMap<T> cm)
38+
where T : class, IIdentity, new()
39+
{
40+
cm.SetIdMember(cm.GetMemberMap(c => c.Id).SetRepresentation(BsonType.ObjectId));
41+
}
42+
43+
[Test]
44+
public void Test()
45+
{
46+
var classMap = new BsonClassMap<Entity>();
47+
classMap.AutoMap();
48+
49+
ConfigureClassMap<Entity>(classMap);
50+
}
51+
}
52+
}

MongoDB.BsonUnitTests/MongoDB.BsonUnitTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
<Compile Include="BsonUtilsTests.cs" />
8484
<Compile Include="IO\ByteArrayBufferTests.cs" />
8585
<Compile Include="IO\MultiChunkBufferTests.cs" />
86+
<Compile Include="Jira\CSharp708Tests.cs" />
8687
<Compile Include="Jira\CSharp476Tests.cs" />
8788
<Compile Include="Jira\CSharp624Tests.cs" />
8889
<Compile Include="Jira\CSharp637Tests.cs" />

0 commit comments

Comments
 (0)