Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
RavenDB-1009 SaveChanges() will throw NullReferenceException if chang…
…ing byte[] property from null to value
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,38 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using Xunit; | |||
|
|||
namespace Raven.Tests.Issues | |||
{ | |||
public class RavenDB1009 : RavenTest | |||
{ | |||
class Foo | |||
{ | |||
public byte[] Hash { get; set; } | |||
} | |||
|
|||
[Fact] | |||
public void CanHandleWhenSettingByteArrayToNull() | |||
{ | |||
using (var store = NewDocumentStore()) | |||
{ | |||
// store a doc | |||
using (var session = store.OpenSession()) | |||
{ | |||
session.Store(new Foo(), "foos/1"); | |||
session.SaveChanges(); | |||
} | |||
|
|||
// store a doc | |||
using (var session = store.OpenSession()) | |||
{ | |||
var foo = session.Load<Foo>("foos/1"); | |||
foo.Hash = new byte[100]; | |||
session.SaveChanges(); | |||
} | |||
} | |||
} | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters