forked from ravendb/ravendb
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMultiLoadInTransaction.cs
57 lines (50 loc) · 1.96 KB
/
MultiLoadInTransaction.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
47
48
49
50
51
52
53
54
55
56
57
// -----------------------------------------------------------------------
// <copyright file="MultiLoadInTransaction.cs" company="Hibernating Rhinos LTD">
// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
using System.Transactions;
using Raven.Tests.Common;
using Xunit;
namespace Raven.Tests.MailingList
{
public class MultiLoadInTransaction : RavenTest
{
[Fact]
public void InsertAndSingleSelect()
{
using (var store = NewRemoteDocumentStore(requestedStorage: "esent", fiddler:true))
{
var expected = new Bar { Id = "test/bar/1", Foo = "Some value" };
using (new TransactionScope())
{
using (var session = store.OpenSession())
{
session.Store(expected);
session.SaveChanges();
}
using (var session = store.OpenSession())
{
var actual = session.Load<Bar>(expected.Id);
Assert.Equal(expected.Id, actual.Id);
Assert.Equal(expected.Foo, actual.Foo);
}
using (var session = store.OpenSession())
{
var actualList = session.Load<Bar>(new[] { expected.Id, "i do not exist" });
Assert.Equal(2, actualList.Length);
Assert.NotNull(actualList[0]);
Assert.Null(actualList[1]);
Assert.Equal(expected.Id, actualList[0].Id);
Assert.Equal(expected.Foo, actualList[0].Foo);
}
}
}
}
public class Bar
{
public string Id { get; set; }
public string Foo { get; set; }
}
}
}