Permalink
Browse files

Spaces -> tabs

  • Loading branch information...
1 parent 8861fd7 commit d2a34282c005508c8bb7929bbc5c0de22148f394 @ayende ayende committed Oct 10, 2011
@@ -5,95 +5,95 @@
namespace Raven.Tests.Bugs.DTC
{
- public class UsingDTCForUpdates : LocalClientTest
- {
- [Fact]
- public void can_update_a_doc_within_transaction_scope()
- {
- using (var documentStore = NewDocumentStore())
- {
- var id1 = Guid.NewGuid();
- RavenJObject dummy = null;
+ public class UsingDTCForUpdates : LocalClientTest
+ {
+ [Fact]
+ public void can_update_a_doc_within_transaction_scope()
+ {
+ using (var documentStore = NewDocumentStore())
+ {
+ var id1 = Guid.NewGuid();
+ RavenJObject dummy = null;
- using (TransactionScope trnx = new TransactionScope())
- {
- using (var session = documentStore.OpenSession())
- {
- dummy = new RavenJObject();
- dummy.Add("Name", "This is the object content");
- dummy.Add("Id", RavenJToken.FromObject(id1));
- session.Store(dummy);
- session.SaveChanges();
+ using (TransactionScope trnx = new TransactionScope())
+ {
+ using (var session = documentStore.OpenSession())
+ {
+ dummy = new RavenJObject();
+ dummy.Add("Name", "This is the object content");
+ dummy.Add("Id", RavenJToken.FromObject(id1));
+ session.Store(dummy);
+ session.SaveChanges();
- }
- using (var session = documentStore.OpenSession())
- {
- session.Store(dummy);
- session.SaveChanges();
- }
- trnx.Complete();
- }
- }
- }
+ }
+ using (var session = documentStore.OpenSession())
+ {
+ session.Store(dummy);
+ session.SaveChanges();
+ }
+ trnx.Complete();
+ }
+ }
+ }
- [Fact]
- public void can_update_a_doc_after_inserting_another_within_transaction_scope()
- {
- using (var documentStore = NewDocumentStore())
- {
- documentStore.Conventions.FindFullDocumentKeyFromNonStringIdentifier = (id, type, allowNull) => id.ToString();
+ [Fact]
+ public void can_update_a_doc_after_inserting_another_within_transaction_scope()
+ {
+ using (var documentStore = NewDocumentStore())
+ {
+ documentStore.Conventions.FindFullDocumentKeyFromNonStringIdentifier = (id, type, allowNull) => id.ToString();
- var id1 = Guid.NewGuid();
- Foo dummy = null;
- Foo dummy2 = null;
+ var id1 = Guid.NewGuid();
+ Foo dummy = null;
+ Foo dummy2 = null;
- // 1. First insert the first object
- using (var session = documentStore.OpenSession())
- {
- dummy = new Foo();
- dummy.Name = "This is the object content";
- dummy.Id = id1;
- session.Store(dummy);
- session.SaveChanges();
- }
+ // 1. First insert the first object
+ using (var session = documentStore.OpenSession())
+ {
+ dummy = new Foo();
+ dummy.Name = "This is the object content";
+ dummy.Id = id1;
+ session.Store(dummy);
+ session.SaveChanges();
+ }
- // 2. Then insert another object and update the first one
- using (TransactionScope trnx = new TransactionScope())
- {
- using (var session = documentStore.OpenSession())
- {
- dummy2 = new Foo();
- dummy2.Name = "This is the object 2 content";
- dummy2.Id = Guid.NewGuid();
- session.Store(dummy2);
- session.SaveChanges();
- }
+ // 2. Then insert another object and update the first one
+ using (TransactionScope trnx = new TransactionScope())
+ {
+ using (var session = documentStore.OpenSession())
+ {
+ dummy2 = new Foo();
+ dummy2.Name = "This is the object 2 content";
+ dummy2.Id = Guid.NewGuid();
+ session.Store(dummy2);
+ session.SaveChanges();
+ }
- using (var session = documentStore.OpenSession())
- {
- dummy.Name = "Some other value";
- session.Store(dummy);
- session.SaveChanges();
- }
- trnx.Complete();
- }
- // 3. Confirm that the update is working !
- using (var session = documentStore.OpenSession())
- {
- session.Advanced.AllowNonAuthoritiveInformation = false;
+ using (var session = documentStore.OpenSession())
+ {
+ dummy.Name = "Some other value";
+ session.Store(dummy);
+ session.SaveChanges();
+ }
+ trnx.Complete();
+ }
+ // 3. Confirm that the update is working !
+ using (var session = documentStore.OpenSession())
+ {
+ session.Advanced.AllowNonAuthoritiveInformation = false;
- var stored = session.Load<Foo>(id1.ToString());
+ var stored = session.Load<Foo>(id1.ToString());
- Assert.Equal(stored.Name , "Some other value");
- }
- }
- }
+ Assert.Equal(stored.Name, "Some other value");
+ }
+ }
+ }
- }
+ }
- public class Foo
- {
- public Guid Id { get; set; }
- public string Name { get; set; }
- }
+ public class Foo
+ {
+ public Guid Id { get; set; }
+ public string Name { get; set; }
+ }
}
@@ -7,58 +7,58 @@
namespace Raven.Tests.Bugs.Indexing
{
- public class CanHaveAnIndexNameThatStartsWithDynamic : LocalClientTest
- {
- public class SomeDoc
- {
- public string MyStringProp { get; set; }
- }
+ public class CanHaveAnIndexNameThatStartsWithDynamic : LocalClientTest
+ {
+ public class SomeDoc
+ {
+ public string MyStringProp { get; set; }
+ }
- public class SomeOtherDoc
- {
- public int MyIntProp { get; set; }
- }
+ public class SomeOtherDoc
+ {
+ public int MyIntProp { get; set; }
+ }
- public class DynamicIndex : AbstractIndexCreationTask<SomeDoc, DynamicIndex.Result>
- {
- public class Result
- {
- public string MyStringProp { get; set; }
- public int Count { get; set; }
- }
+ public class DynamicIndex : AbstractIndexCreationTask<SomeDoc, DynamicIndex.Result>
+ {
+ public class Result
+ {
+ public string MyStringProp { get; set; }
+ public int Count { get; set; }
+ }
- public DynamicIndex ()
- {
- Map = docs => from doc in docs
- select new { MyStringProp = doc.MyStringProp, Count = 1 };
+ public DynamicIndex()
+ {
+ Map = docs => from doc in docs
+ select new { MyStringProp = doc.MyStringProp, Count = 1 };
- Reduce = results => from result in results
- group result by result.MyStringProp
- into g
- select new { MyStringProp = g.Key, Count = g.Sum(x => x.Count) };
+ Reduce = results => from result in results
+ group result by result.MyStringProp
+ into g
+ select new { MyStringProp = g.Key, Count = g.Sum(x => x.Count) };
- }
- }
+ }
+ }
- [Fact]
- public void CanHaveAnIndexWithANameThatStartsWithTheWordDynamic()
- {
- using (var store = NewDocumentStore())
- {
- using (var s = store.OpenSession())
- {
- var one = new SomeDoc { MyStringProp = "Test" };
- var two = new SomeDoc { MyStringProp = "two" };
- var other = new SomeOtherDoc { MyIntProp = 1 };
- s.Store(one);
- s.Store(two);
- s.Store(other);
- s.SaveChanges();
- new DynamicIndex().Execute(store);
- var list = s.Query<DynamicIndex.Result, DynamicIndex>().Customize(x => x.WaitForNonStaleResultsAsOfNow()).ToList();
- Assert.NotEqual(0, list.Count());
- }
- }
- }
- }
+ [Fact]
+ public void CanHaveAnIndexWithANameThatStartsWithTheWordDynamic()
+ {
+ using (var store = NewDocumentStore())
+ {
+ using (var s = store.OpenSession())
+ {
+ var one = new SomeDoc { MyStringProp = "Test" };
+ var two = new SomeDoc { MyStringProp = "two" };
+ var other = new SomeOtherDoc { MyIntProp = 1 };
+ s.Store(one);
+ s.Store(two);
+ s.Store(other);
+ s.SaveChanges();
+ new DynamicIndex().Execute(store);
+ var list = s.Query<DynamicIndex.Result, DynamicIndex>().Customize(x => x.WaitForNonStaleResultsAsOfNow()).ToList();
+ Assert.NotEqual(0, list.Count());
+ }
+ }
+ }
+ }
}
@@ -1,44 +1,44 @@
namespace Raven.Tests.Bugs.Iulian
{
- using System.Linq;
- using Xunit;
+ using System.Linq;
+ using Xunit;
- public class GeneratesCorrectTemporaryIndex : LocalClientTest
- {
- public class Inner
- {
- public bool Flag { get; set; }
- }
+ public class GeneratesCorrectTemporaryIndex : LocalClientTest
+ {
+ public class Inner
+ {
+ public bool Flag { get; set; }
+ }
- public class Outer
- {
- public Inner Inner { get; set; }
- }
+ public class Outer
+ {
+ public Inner Inner { get; set; }
+ }
- [Fact]
- public void Can_Generate_Correct_Temporary_Index()
- {
- using (var store = base.NewDocumentStore("munin", false))
- {
- using (var s = store.OpenSession())
- {
- // store the element
- Outer outer = new Outer { Inner = new Inner { Flag = true } };
- s.Store(outer);
- s.SaveChanges();
- }
+ [Fact]
+ public void Can_Generate_Correct_Temporary_Index()
+ {
+ using (var store = base.NewDocumentStore("munin", false))
+ {
+ using (var s = store.OpenSession())
+ {
+ // store the element
+ Outer outer = new Outer { Inner = new Inner { Flag = true } };
+ s.Store(outer);
+ s.SaveChanges();
+ }
- using (var s = store.OpenSession())
- {
- // query by the inner flag
- Outer outer = s.Query<Outer>()
- .Customize(x=>x.WaitForNonStaleResults())
+ using (var s = store.OpenSession())
+ {
+ // query by the inner flag
+ Outer outer = s.Query<Outer>()
+ .Customize(x => x.WaitForNonStaleResults())
.Where(o => o.Inner.Flag).SingleOrDefault();
- Assert.NotNull(outer); // this fails
- }
- }
- }
- }
+ Assert.NotNull(outer); // this fails
+ }
+ }
+ }
+ }
}

0 comments on commit d2a3428

Please sign in to comment.