Skip to content

Commit

Permalink
v4.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nightroman committed Jun 19, 2014
1 parent 15d7cfe commit 748e64e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
5 changes: 2 additions & 3 deletions .build.ps1
Expand Up @@ -268,11 +268,10 @@ task CheckFiles {
}}
}

# Synopsis: Call tests.
# Synopsis: Call tests and test the expected count.
task Test {
Invoke-Build ** Tests -Result result
$testCount = 155
if ($testCount -ne $result.Tasks.Count) {Write-Warning "Unexpected test count:`n Sample : $testCount`n Result : $($result.Tasks.Count)"}
assert (156 -eq $result.Tasks.Count) "Unexpected test count: $($result.Tasks.Count)."
},
CleanTest

Expand Down
4 changes: 4 additions & 0 deletions Release-Notes.md
Expand Up @@ -2,6 +2,10 @@
Mdbc Release Notes
==================

## v4.8.0

Resolved #2. `Mdbc.Dictionary` gets null on `$data['missing-key']`.

## v4.7.3

C# driver v1.9.1
Expand Down
3 changes: 2 additions & 1 deletion Src/Dictionary.cs
Expand Up @@ -72,7 +72,8 @@ public void CopyTo(Array array, int index)
get
{
if (key == null) throw new ArgumentNullException("key");
return Actor.ToObject(_document.GetValue(key.ToString()));
BsonValue value;
return _document.TryGetValue(key.ToString(), out value) ? Actor.ToObject(value) : null;
}
set
{
Expand Down
2 changes: 1 addition & 1 deletion Src/Mdbc.csproj
Expand Up @@ -114,7 +114,7 @@
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>PowerShell.exe -NoProfile Invoke-Build.ps1 PostBuild $(ProjectDir)\..\.build.ps1 -Configuration $(ConfigurationName)</PostBuildEvent>
<PostBuildEvent>ib PostBuild $(ProjectDir)\..\.build.ps1 -Configuration $(ConfigurationName)</PostBuildEvent>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup>
</Project>
12 changes: 12 additions & 0 deletions Tests/Dictionary.test.ps1
Expand Up @@ -21,6 +21,18 @@ task Constructors {
Test-Error { [Mdbc.Dictionary]$Host } '*cannot be mapped to a BsonValue.*'
}

# v4.8.0
task GetMissing {
$d = New-MdbcData

# get missing as null by []
assert ($null -eq $d['missing'])

# dot notation fails in strict mode
$$ = try { $d.missing } catch {$_}
assert ($$ -like "Property 'missing' cannot be found on this object.*")
}

# $null should be preserved
task SetNull {
$d = New-MdbcData @{x = 1; y = 2}
Expand Down

0 comments on commit 748e64e

Please sign in to comment.