forked from ravendb/ravendb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRavenDB_2613.cs
71 lines (59 loc) · 1.59 KB
/
RavenDB_2613.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// -----------------------------------------------------------------------
// <copyright file="RavenDB_2613.cs" company="Hibernating Rhinos LTD">
// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
using System;
using System.Transactions;
using Raven.Tests.Helpers;
using Xunit;
namespace Raven.DtcTests
{
public class RavenDB_2613 : RavenTestBase
{
[Fact]
public void MaxNumberOfRequestsPerSessionShouldNotImpactDtc()
{
using (var store = NewRemoteDocumentStore(requestedStorage: "esent"))
{
store.Conventions.MaxNumberOfRequestsPerSession = 2;
var id = Guid.NewGuid().ToString();
using (var session = store.OpenSession())
{
session.Store(new TestClass { Id = id });
session.SaveChanges();
}
Console.WriteLine("Initial doc created");
try
{
using (var scope = new TransactionScope())
{
using (var session = store.OpenSession())
{
session.Advanced.AllowNonAuthoritativeInformation = false;
var doc = session.Load<TestClass>(id);
doc.Blah++;
session.SaveChanges();
}
scope.Complete();
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
Console.WriteLine("Retrieve initial document");
using (var session = store.OpenSession())
{
session.Advanced.AllowNonAuthoritativeInformation = false;
session.Load<TestClass>(id);
}
}
}
public class TestClass
{
public string Id { get; set; }
public int Blah { get; set; }
}
}
}