Skip to content

Commit 4c37e05

Browse files
committed
CSHARP-613: added test proving that this is fixed.
1 parent 7a51a94 commit 4c37e05

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/* Copyright 2010-2014 MongoDB 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 System.Linq;
17+
using MongoDB.Driver.Linq;
18+
using NUnit.Framework;
19+
20+
namespace MongoDB.DriverUnitTests.Jira.CSharp613
21+
{
22+
[TestFixture]
23+
public class CSharp613Tests
24+
{
25+
private class C
26+
{
27+
public int Id;
28+
public short S;
29+
}
30+
31+
[Test]
32+
public void TestShortToIntImplicitConversion()
33+
{
34+
var collection = Configuration.TestCollection;
35+
36+
collection.Drop();
37+
collection.Save(new C { Id = 0, S = 2 });
38+
39+
var query = from c in collection.AsQueryable<C>()
40+
where c.S == 2
41+
select c;
42+
43+
var result = query.FirstOrDefault();
44+
Assert.IsNotNull(result);
45+
Assert.AreEqual(2, result.S);
46+
}
47+
}
48+
}

MongoDB.DriverUnitTests/MongoDB.DriverUnitTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
<Compile Include="GeoJsonObjectModel\GeoJsonMultiPolygonTests.cs" />
130130
<Compile Include="GeoJsonObjectModel\GeoJsonPointTests.cs" />
131131
<Compile Include="GeoJsonObjectModel\GeoJsonPolygonTests.cs" />
132+
<Compile Include="Jira\CSharp613Tests.cs" />
132133
<Compile Include="Jira\CSharp542Tests.cs" />
133134
<Compile Include="Jira\CSharp653Tests.cs" />
134135
<Compile Include="Jira\CSharp714Tests.cs" />

0 commit comments

Comments
 (0)