Permalink
Browse files

Merge branch 'master' of https://github.com/etishor/ravendb

Conflicts:
	Raven.Tests/Raven.Tests.csproj
  • Loading branch information...
2 parents 7ad8e63 + 271c803 commit d15520486ad61743f3230bec6e95b42384045950 @ayende ayende committed Oct 9, 2011
@@ -0,0 +1,56 @@
+
+namespace Raven.Tests.Bugs.Iulian
+{
+ using System.Linq;
+ using Xunit;
+
+ /// <summary>
+ /// Test that verifies that the generated index is correct.
+ /// The following index is generated:
+ /// Name: Temp/Outers/ByFlag
+ /// Map: from doc in docs.Outers select new { Flag = doc.Flag }
+ ///
+ /// The map part is wrong since the projection should be new { Flag = doc.Inner.Flag }
+ ///
+ /// </summary>
+ public class GeneratesCorrectTemporaryIndex : LocalClientTest
+ {
+ public class Inner
+ {
+ public bool Flag { get; set; }
+ }
+
+ public class Outer
+ {
+ public Inner Inner { get; set; }
+ }
+
+ [Fact]
+ public void Can_Generate_Correct_Temporary_Index()
+ {
+ using (var store = base.NewDocumentStore().Initialize())
+ {
+ 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())
+ {
+ // verify that the element is saved as expected ( this passes )
+ Outer test = s.Query<Outer>().SingleOrDefault();
+ Assert.NotNull(test);
+ Assert.True(test.Inner.Flag);
+
+ // query by the inner flag
+ Outer outer = s.Query<Outer>().Where(o => o.Inner.Flag).SingleOrDefault();
+
+ Assert.NotNull(outer); // this fails
+ }
+ }
+ }
+ }
+}
@@ -179,6 +179,7 @@
<Compile Include="Bugs\Indexing\InvalidIndexes.cs" />
<Compile Include="Bugs\Issue355.cs" />
<Compile Include="Bugs\LarsErik.cs" />
+ <Compile Include="Bugs\Iulian\GeneratesCorrectTemporaryIndex.cs" />
<Compile Include="Bugs\LiveProjections\Entities\Place.cs" />
<Compile Include="Bugs\LiveProjections\Entities\Task.cs" />
<Compile Include="Bugs\LiveProjections\Entities\TaskSummary.cs" />
@@ -0,0 +1,7 @@
+$i = 1
+while($true) {
+ echo "try #$i"
+ .\build\xunit.console.clr4.exe .\build\Raven.Bundles.Tests.dll
+ cls
+ $i = $i + 1
+}

0 comments on commit d155204

Please sign in to comment.