Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:ayende/ravendb

  • Loading branch information...
commit 5229070de223fe016e4411553192d4e6a2a7bbf2 2 parents 5ed1eb6 + b4f9bf0
@ayende ayende authored
Showing with 99,486 additions and 98,975 deletions.
  1. +10 −0 Raven.Client.Lightweight/Document/RavenClientEnlistment.cs
  2. +4 −1 Raven.Database/Bundles/Quotas/Documents/Triggers/DatabaseCountDocumentDeleteTrigger.cs
  3. +4 −1 Raven.Database/Bundles/Quotas/Size/Triggers/DatabaseSizeAttachmentDeleteTrigger.cs
  4. +4 −1 Raven.Database/Bundles/Quotas/Size/Triggers/DatabaseSizeDocumentDeleteTrigger.cs
  5. +12 −12 Raven.Database/Imports/Lucene.Net/FastVectorHightlighter/BaseFragmentsBuilder.cs
  6. +28 −0 Raven.Database/Linq/Ast/TransformGroupByExtensionMethodTransformer.cs
  7. +16 −4 Raven.Database/Linq/DynamicViewCompiler.cs
  8. +5 −0 Raven.Database/Linq/PrivateExtensions/LinqOnDynamic.cs
  9. +1 −0  Raven.Database/Raven.Database.csproj
  10. +19 −0 Raven.Tests.Helpers/RavenTestBase.cs
  11. +74 −74 Raven.Tests.Silverlight/Statistics.cs
  12. +162 −162 Raven.Tests/Bugs/CS1977.cs
  13. +9 −9 Raven.Tests/Bugs/CompiledIndexes/Network.cs
  14. +10 −10 Raven.Tests/Bugs/CompiledIndexes/NetworkList.cs
  15. +19 −19 Raven.Tests/Bugs/ConnectionStringParsing.cs
  16. +43 −43 Raven.Tests/Bugs/DirectoryCreation.cs
  17. +8 −8 Raven.Tests/Bugs/EntityWithNullableDateTimeOffset.cs
  18. +19 −19 Raven.Tests/Bugs/FailDelete.cs
  19. +24 −24 Raven.Tests/Bugs/FailStore.cs
  20. +134 −134 Raven.Tests/Bugs/Identifiers/SpecialCharactersOnIIS.cs
  21. +12 −12 Raven.Tests/Bugs/Image.cs
  22. +12 −12 Raven.Tests/Bugs/ImageByTagSearchModel.cs
  23. +38 −38 Raven.Tests/Bugs/InMemoryOnly.cs
  24. +47 −47 Raven.Tests/Bugs/IndexDefinitionEquality.cs
  25. +6 −6 Raven.Tests/Bugs/Indexing/Transaction.cs
  26. +17 −17 Raven.Tests/Bugs/Indexing/Transaction_ByMrn.cs
  27. +51 −51 Raven.Tests/Bugs/LinqOnUrls.cs
  28. +8 −8 Raven.Tests/Bugs/LiveProjections/Entities/Place.cs
  29. +12 −12 Raven.Tests/Bugs/LiveProjections/Entities/Product.cs
  30. +14 −14 Raven.Tests/Bugs/LiveProjections/Entities/ProductSku.cs
  31. +20 −20 Raven.Tests/Bugs/LiveProjections/Entities/Task.cs
  32. +26 −26 Raven.Tests/Bugs/LiveProjections/Entities/TaskSummary.cs
  33. +8 −8 Raven.Tests/Bugs/LiveProjections/Entities/User.cs
  34. +36 −36 Raven.Tests/Bugs/LiveProjections/Indexes/ProductDetailsReport_ByProductId.cs
  35. +46 −46 Raven.Tests/Bugs/LiveProjections/Indexes/ProductSkuListViewModelReport_ByArticleNumberAndName.cs
  36. +34 −34 Raven.Tests/Bugs/LiveProjections/Indexes/TaskSummaryIndex.cs
  37. +19 −19 Raven.Tests/Bugs/LiveProjections/ParentAndChildrenNames.cs
  38. +7 −7 Raven.Tests/Bugs/LiveProjections/Person.cs
  39. +12 −12 Raven.Tests/Bugs/LiveProjections/Views/ProductDetailsReport.cs
  40. +14 −14 Raven.Tests/Bugs/LiveProjections/Views/ProductSkuListViewModelReport.cs
  41. +12 −12 Raven.Tests/Bugs/LiveProjections/Views/ProductVariant.cs
  42. +25 −25 Raven.Tests/Bugs/MapRedue/DocumentView.cs
  43. +66 −66 Raven.Tests/Bugs/MapRedue/LetInReduceFunction.cs
  44. +25 −25 Raven.Tests/Bugs/MapRedue/VersionedDocument.cs
  45. +7 −7 Raven.Tests/Bugs/MultiTenancy/Test.cs
  46. +13 −13 Raven.Tests/Bugs/NameAndId.cs
  47. +69 −69 Raven.Tests/Bugs/OverwriteIndexRemotely.cs
  48. +64 −64 Raven.Tests/Bugs/QueryWithPercentageSignp.cs
  49. +49 −49 Raven.Tests/Bugs/QueryingOnEmptyString.cs
  50. +98 −98 Raven.Tests/Bugs/SortingWithWildcardQuery.cs
  51. +19 −19 Raven.Tests/Bugs/TransformResults/Answer.cs
  52. +20 −20 Raven.Tests/Bugs/TransformResults/AnswerEntity.cs
  53. +12 −12 Raven.Tests/Bugs/TransformResults/AnswerViewItem.cs
  54. +19 −19 Raven.Tests/Bugs/TransformResults/AnswerVote.cs
  55. +19 −19 Raven.Tests/Bugs/TransformResults/AnswerVoteEntity.cs
  56. +49 −49 Raven.Tests/Bugs/TransformResults/Answers_ByQuestion.cs
  57. +18 −18 Raven.Tests/Bugs/TransformResults/Question.cs
  58. +13 −13 Raven.Tests/Bugs/TransformResults/QuestionView.cs
  59. +7 −7 Raven.Tests/Bugs/TransformResults/QuestionVote.cs
  60. +40 −40 Raven.Tests/Bugs/TransformResults/QuestionWithVoteTotalIndex.cs
  61. +9 −9 Raven.Tests/Bugs/TransformResults/Thor.cs
  62. +16 −16 Raven.Tests/Bugs/TransformResults/ThorIndex.cs
  63. +8 −8 Raven.Tests/Bugs/TransformResults/User.cs
  64. +18 −18 Raven.Tests/Bugs/User.cs
  65. +9 −9 Raven.Tests/Bugs/UserGuid.cs
  66. +7 −7 Raven.Tests/Bugs/UserInt32.cs
  67. +55 −55 Raven.Tests/Document/CasingIssue.cs
  68. +28 −28 Raven.Tests/Document/Company.cs
  69. +15 −15 Raven.Tests/Document/Contact.cs
  70. +38 −38 Raven.Tests/Document/CustomDynamicClass.cs
  71. +48 −48 Raven.Tests/Document/DocumentStoreEmbeddedGranularTests.cs
  72. +20 −20 Raven.Tests/Document/DocumentStoreServerGranularTests.cs
  73. +74 −74 Raven.Tests/Document/Inheritance.cs
  74. +74 −74 Raven.Tests/Document/TotalCountServerTest.cs
  75. +68 −68 Raven.Tests/Document/WhenUsingMultipleUnshardedServers.cs
  76. +12 −12 Raven.Tests/Document/ZoneCountResult.cs
  77. +18 −18 Raven.Tests/Indexes/CustomAnalyzer.cs
  78. +61 −61 Raven.Tests/Indexes/DynamicFieldIndexing.cs
  79. +46 −46 Raven.Tests/Indexes/ExpressionOperatorPrecedenceTest.cs
  80. +19 −19 Raven.Tests/Linq/CommitInfo.cs
  81. +298 −0 Raven.Tests/Linq/GroupByAndDocumentId.cs
  82. +91 −91 Raven.Tests/Linq/PerformingQueries.cs
  83. +27 −27 Raven.Tests/Linq/SampleDynamicCompilationExtension.cs
  84. +14 −14 Raven.Tests/Linq/SampleGeoLocation.cs
  85. +26 −26 Raven.Tests/Linq/User.cs
  86. +58 −58 Raven.Tests/MailingList/Asger.cs
  87. +49 −49 Raven.Tests/MailingList/Benjamin.cs
  88. +29 −29 Raven.Tests/MailingList/BrunoLopes.cs
  89. +38 −38 Raven.Tests/MailingList/EnumAsInts.cs
  90. +28 −28 Raven.Tests/MailingList/EtagUsage.cs
  91. +88 −88 Raven.Tests/MailingList/Idsa/Casino.cs
  92. +42 −42 Raven.Tests/MailingList/Idsa/CasinosSuspensionsIndex.cs
  93. +35 −35 Raven.Tests/MailingList/IndexWithUnion.cs
  94. +111 −111 Raven.Tests/MailingList/Maverix.cs
  95. +88 −88 Raven.Tests/MailingList/NicolasGarfinkiel.cs
  96. +52 −52 Raven.Tests/MailingList/Oregon.cs
  97. +41 −41 Raven.Tests/MailingList/Random.cs
  98. +57 −57 Raven.Tests/MailingList/RecreatingIndexes.cs
  99. +55 −55 Raven.Tests/MailingList/Samina.cs
  100. +37 −37 Raven.Tests/MailingList/ronne.cs
  101. +51 −51 Raven.Tests/Munin/CanWorkWithTwoDicsInSameFile.cs
  102. +73 −73 Raven.Tests/Munin/MyToDoList.cs
  103. +93 −93 Raven.Tests/Munin/Optimize.cs
  104. +49 −49 Raven.Tests/Munin/PutsAfterRestart.cs
  105. +14 −14 Raven.Tests/Munin/ToDo.cs
  106. +125 −0 Raven.Tests/Querying/HighlightesTests.cs
  107. +16 −16 Raven.Tests/Querying/IndexedUser.cs
  108. +2 −0  Raven.Tests/Raven.Tests.csproj
  109. +10 −10 Raven.Tests/RemoteClientTest.cs
  110. +79 −79 Raven.Tests/Security/OAuth/HttpWebRequestExtensions.cs
  111. +7 −7 Raven.Tests/Shard/BlogModel/Blog.cs
  112. +158 −158 Raven.Tests/Shard/BlogModel/CanQueryOnlyPosts.cs
  113. +84 −84 Raven.Tests/Shard/BlogModel/CanQueryOnlyUsers.cs
  114. +14 −14 Raven.Tests/Shard/BlogModel/Post.cs
  115. +34 −34 Raven.Tests/Shard/BlogModel/ShardedDocumentSessionIsWorking.cs
  116. +7 −7 Raven.Tests/Shard/BlogModel/User.cs
  117. +96 −96 Raven.Tests/Shard/SimpleSharding.cs
  118. +44 −44 Raven.Tests/Spatial/Event.cs
  119. +70 −70 Raven.Tests/Storage/AbstractDocumentStorageTest.cs
  120. +127 −127 Raven.Tests/Track/RavenDB053.cs
  121. +14 −14 Raven.Tests/Triggers/AuditAttachmentPutTrigger.cs
  122. +26 −26 Raven.Tests/Triggers/Bugs/AuditContext.cs
  123. +11 −11 Raven.Tests/Triggers/Bugs/Person.cs
  124. +35 −35 Raven.Tests/Triggers/CascadeDeleteTrigger.cs
  125. +16 −16 Raven.Tests/Triggers/RefuseBigAttachmentPutTrigger.cs
  126. +25 −25 Raven.Tests/Triggers/VetoCapitalNamesPutTrigger.cs
  127. +34 −34 Raven.Tests/Util/ReflectionUtilTest.cs
  128. +95 −95 Raven.Tests/Views/ViewCompilation.cs
  129. +29 −29 Raven.Web/Web.Debug.config
  130. +30 −30 Raven.Web/Web.Release.config
  131. +56 −56 Samples/Raven.Bundles.Sample.EventSourcing.ShoppingCartAggregator/ShoppingCart.cs
  132. +18 −18 Samples/Raven.Bundles.Sample.EventSourcing.ShoppingCartAggregator/ShoppingCartCustomer.cs
  133. +63 −63 Samples/Raven.Bundles.Sample.EventSourcing.ShoppingCartAggregator/ShoppingCartEventsToShopingCart.cs
  134. +18 −18 Samples/Raven.Bundles.Sample.EventSourcing.ShoppingCartAggregator/ShoppingCartItem.cs
  135. +19 −19 Samples/Raven.Bundles.Sample.EventSourcing.ShoppingCartAggregator/ShoppingCartItemProduct.cs
  136. +8 −8 Samples/Raven.Sample.EventSourcing/Read Me.txt
  137. +5 −5 Samples/Raven.Sample.EventSourcing/Start Raven.ps1
  138. +35 −35 Samples/Raven.Sample.FSharp/Program.fs
  139. +8 −8 Samples/Raven.Sample.Failover/Read Me.txt
  140. +13 −13 Samples/Raven.Sample.Failover/User.cs
  141. +124 −124 Samples/Raven.Sample.LiveProjections/Program.cs
  142. +37 −37 Samples/Raven.Sample.MultiTenancy/Program.cs
  143. +19 −19 Samples/Raven.Sample.Replication/Read Me.txt
  144. +12 −12 Samples/Raven.Sample.Replication/Start Raven.ps1
  145. +1 −1  Samples/Raven.Sample.ShardClient/.gitignore
  146. +13 −13 Samples/Raven.Sample.ShardClient/Company.cs
  147. +11 −11 Samples/Raven.Sample.ShardClient/Invoice.cs
  148. +35 −35 Samples/Raven.Sample.ShardClient/InvoicesAmountByDate.cs
  149. +11 −11 Samples/Raven.Sample.ShardClient/Read Me.txt
  150. +17 −17 Samples/Raven.Sample.ShardClient/Start Raven.ps1
  151. +21 −21 Samples/Raven.Sample.SimpleClient/Company.cs
  152. +105 −105 Samples/Raven.Sample.Suggestions/Program.cs
  153. +20 −20 Samples/Raven.Samples.Includes/Companies_ByRegion.cs
  154. +15 −15 Samples/Raven.Samples.Includes/Company.cs
  155. +63 −63 Samples/Raven.Samples.Includes/Program.cs
  156. +30,180 −30,180 SharedLibs/Esent.Interop.XML
  157. +5,413 −5,413 SharedLibs/Rhino.Mocks.xml
  158. +1,256 −1,256 SharedLibs/Silverlight/Expression/SL5/Microsoft.Expression.Interactions.xml
  159. +1,025 −1,025 SharedLibs/Silverlight/System.Windows.Interactivity.xml
  160. +1,983 −1,983 SharedLibs/Silverlight/Toolkit v5.0/Microsoft.Xna.Framework.Content.xml
  161. +330 −330 SharedLibs/Silverlight/Toolkit v5.0/Microsoft.Xna.Framework.Toolkit.xml
  162. +11 −11 SharedLibs/Silverlight/Toolkit v5.0/System.Windows.Controls.Data.DataForm.Toolkit.extmap.xml
  163. +2,831 −2,831 SharedLibs/Silverlight/Toolkit v5.0/System.Windows.Controls.Data.DataForm.Toolkit.xml
  164. +11 −11 SharedLibs/Silverlight/Toolkit v5.0/System.Windows.Controls.Data.Toolkit.extmap.xml
  165. +359 −359 SharedLibs/Silverlight/Toolkit v5.0/System.Windows.Controls.Data.Toolkit.xml
  166. +11 −11 SharedLibs/Silverlight/Toolkit v5.0/System.Windows.Controls.DataVisualization.Toolkit.extmap.xml
  167. +11,539 −11,539 SharedLibs/Silverlight/Toolkit v5.0/System.Windows.Controls.DataVisualization.Toolkit.xml
  168. +11 −11 SharedLibs/Silverlight/Toolkit v5.0/System.Windows.Controls.Input.Toolkit.extmap.xml
  169. +7,667 −7,667 SharedLibs/Silverlight/Toolkit v5.0/System.Windows.Controls.Input.Toolkit.xml
  170. +11 −11 SharedLibs/Silverlight/Toolkit v5.0/System.Windows.Controls.Layout.Toolkit.extmap.xml
  171. +2,637 −2,637 SharedLibs/Silverlight/Toolkit v5.0/System.Windows.Controls.Layout.Toolkit.xml
  172. +11 −11 SharedLibs/Silverlight/Toolkit v5.0/System.Windows.Controls.Theming.Toolkit.extmap.xml
  173. +284 −284 SharedLibs/Silverlight/Toolkit v5.0/System.Windows.Controls.Theming.Toolkit.xml
  174. +11 −11 SharedLibs/Silverlight/Toolkit v5.0/System.Windows.Controls.Toolkit.extmap.xml
  175. +9,819 −9,819 SharedLibs/Silverlight/Toolkit v5.0/System.Windows.Controls.Toolkit.xml
  176. +11 −11 SharedLibs/Silverlight/Toolkit v5.0/Testing/Microsoft.Silverlight.Testing.extmap.xml
  177. +14,823 −14,823 SharedLibs/Silverlight/Toolkit v5.0/Testing/Microsoft.Silverlight.Testing.xml
  178. +11 −11 ...ibs/Silverlight/Toolkit v5.0/Testing/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.extmap.xml
  179. +3,429 −3,429 SharedLibs/Silverlight/Toolkit v5.0/Testing/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.xml
  180. +2 −0  default.ps1
View
10 Raven.Client.Lightweight/Document/RavenClientEnlistment.cs
@@ -63,6 +63,16 @@ public void Prepare(PreparingEnlistment preparingEnlistment)
catch (Exception e)
{
logger.ErrorException("Could not prepare distributed transaction", e);
+ try
+ {
+ session.Rollback(PromotableRavenClientEnlistment.GetLocalOrDistributedTransactionId(transaction));
+ DeleteFile();
+ }
+ catch (Exception e2)
+ {
+ logger.ErrorException("Could not roll back transaction after prepare failed", e2);
+ }
+
preparingEnlistment.ForceRollback(e);
return;
}
View
5 Raven.Database/Bundles/Quotas/Documents/Triggers/DatabaseCountDocumentDeleteTrigger.cs
@@ -11,7 +11,10 @@ public class DatabaseCountDocumentDeleteTrigger : AbstractDeleteTrigger
{
public override void AfterDelete(string key, Abstractions.Data.TransactionInformation transactionInformation)
{
- DocQuotaConfiguration.GetConfiguration(Database).AfterDelete();
+ using (Database.DisableAllTriggersForCurrentThread())
+ {
+ DocQuotaConfiguration.GetConfiguration(Database).AfterDelete();
+ }
}
}
}
View
5 Raven.Database/Bundles/Quotas/Size/Triggers/DatabaseSizeAttachmentDeleteTrigger.cs
@@ -9,7 +9,10 @@ public class DatabaseSizeAttachmentDeleteTrigger : AbstractAttachmentDeleteTrigg
{
public override void AfterDelete(string key)
{
- SizeQuotaConfiguration.GetConfiguration(Database).AfterDelete();
+ using (Database.DisableAllTriggersForCurrentThread())
+ {
+ SizeQuotaConfiguration.GetConfiguration(Database).AfterDelete();
+ }
}
}
}
View
5 Raven.Database/Bundles/Quotas/Size/Triggers/DatabaseSizeDocumentDeleteTrigger.cs
@@ -9,7 +9,10 @@ public class DatabaseSizeDocumentDeleteTrigger : AbstractDeleteTrigger
{
public override void AfterDelete(string key, Abstractions.Data.TransactionInformation transactionInformation)
{
- SizeQuotaConfiguration.GetConfiguration(Database).AfterDelete();
+ using (Database.DisableAllTriggersForCurrentThread())
+ {
+ SizeQuotaConfiguration.GetConfiguration(Database).AfterDelete();
+ }
}
}
}
View
24 Raven.Database/Imports/Lucene.Net/FastVectorHightlighter/BaseFragmentsBuilder.cs
@@ -271,19 +271,19 @@ private string TrimEdges(StringBuilder buffer, int startOffset, int endOffset, o
localStart = startOffset;
}
- if (endOffset != buffer.Length && buffer[endOffset] != ' ')
- {
- while (buffer[localEnd] != ' ' && localEnd != localStart && localEnd > minEnd)
- {
- localEnd--;
- }
+ if (endOffset + 1 < buffer.Length && buffer[endOffset + 1] != ' ')
+ {
+ while (buffer[localEnd] != ' ' && localEnd != localStart && localEnd > minEnd)
+ {
+ localEnd--;
+ }
- if (localEnd == localStart)
- {
- localEnd = endOffset;
- localStart = startOffset;
- }
- }
+ if (localEnd == localStart)
+ {
+ localEnd = endOffset;
+ localStart = startOffset;
+ }
+ }
retStartOffset = localStart;
return buffer.ToString(localStart, localEnd - localStart);
View
28 Raven.Database/Linq/Ast/TransformGroupByExtensionMethodTransformer.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Linq;
+using ICSharpCode.NRefactory.CSharp;
+using Raven.Database.Linq.PrivateExtensions;
+
+namespace Raven.Database.Linq.Ast
+{
+ [CLSCompliant(false)]
+ public class TransformGroupByExtensionMethodTransformer : DepthFirstAstVisitor<object,object>
+ {
+ public override object VisitInvocationExpression(InvocationExpression invocationExpression, object data)
+ {
+ var memberReferenceExpression = invocationExpression.Target as MemberReferenceExpression;
+ if (memberReferenceExpression != null && memberReferenceExpression.MemberName == "GroupBy")
+ {
+ var newInvocation = new InvocationExpression(
+ new MemberReferenceExpression(
+ new TypeReferenceExpression(new SimpleType(typeof (LinqOnDynamic).FullName)),
+ memberReferenceExpression.MemberName),
+ invocationExpression.Arguments.Select(x => x.Clone())
+ );
+ invocationExpression.ReplaceWith(newInvocation);
+ }
+
+ return base.VisitInvocationExpression(invocationExpression, data);
+ }
+ }
+}
View
20 Raven.Database/Linq/DynamicViewCompiler.cs
@@ -355,7 +355,7 @@ private static LambdaExpression GetLambdaExpression(InvocationExpression invocat
private void ValidateMapReduceFields(List<string> mapFields)
{
- mapFields.Remove("__document_id");
+ mapFields.Remove(Constants.DocumentIdFieldName);
var reduceFields = captureSelectNewFieldNamesVisitor.FieldNames;
if (reduceFields.SetEquals(mapFields) == false)
{
@@ -425,12 +425,24 @@ private bool AddDocumentIdFieldToLambdaIfCreatingNewObject(LambdaExpression lamb
return false;
var initializers = objectCreateExpression.Initializers;
-
- var identifierExpression = new IdentifierExpression(lambdaExpression.Parameters.First().Name);
-
if (initializers.OfType<NamedExpression>().Any(x => x.Name == Constants.DocumentIdFieldName))
return false;
+ var parameter = lambdaExpression.Parameters.First();
+ var identifier = parameter.Name;
+
+ // Support getting the __document_id from IGrouping parameter
+ var castExpression = parameter.Parent.Parent.Parent as CastExpression;
+ if (castExpression != null)
+ {
+ var simpleType = castExpression.Type as SimpleType;
+ if (simpleType != null && simpleType.Identifier == "Func<IGrouping<dynamic,dynamic>, dynamic>")
+ {
+ identifier += ".Key";
+ }
+ }
+
+ var identifierExpression = new IdentifierExpression(identifier);
objectCreateExpression.Initializers.Add(new NamedExpression
{
Name = Constants.DocumentIdFieldName,
View
5 Raven.Database/Linq/PrivateExtensions/LinqOnDynamic.cs
@@ -42,6 +42,11 @@ IEnumerator IEnumerable.GetEnumerator()
return Enumerable.GroupBy(source, keySelector).Select(inner => new WrapperGrouping(inner));
}
+ public static IEnumerable<IGrouping<dynamic, dynamic>> GroupBy(this IEnumerable<dynamic> source, Func<dynamic, dynamic> keySelector, Func<dynamic, dynamic> resultSelector)
+ {
+ return Enumerable.GroupBy(source, keySelector, resultSelector).Select(inner => new WrapperGrouping(inner));
+ }
+
private static IEnumerable<dynamic> Select(this object self)
{
if (self == null || self is DynamicNullObject)
View
1  Raven.Database/Raven.Database.csproj
@@ -238,6 +238,7 @@
<Compile Include="Indexing\RavenPerFieldAnalyzerWrapper.cs" />
<Compile Include="Indexing\Spatial\RecursivePrefixTreeStrategyThatSupportsWithin.cs" />
<Compile Include="Json\ScriptsCache.cs" />
+ <Compile Include="Linq\Ast\TransformGroupByExtensionMethodTransformer.cs" />
<Compile Include="Linq\Ast\ThrowOnInvalidMethodCallsForTransformResults.cs" />
<Compile Include="Linq\Ast\TransformObsoleteMethods.cs" />
<Compile Include="Linq\CodeVerifier.cs" />
View
19 Raven.Tests.Helpers/RavenTestBase.cs
@@ -29,6 +29,7 @@
using Raven.Json.Linq;
using Raven.Server;
using Xunit;
+using Xunit.Sdk;
namespace Raven.Tests.Helpers
{
@@ -356,5 +357,23 @@ protected static void PrintServerErrors(ServerError[] serverErrors)
else
Console.WriteLine("No server errors");
}
+
+ protected void AssertNoIndexErrors(IDocumentStore documentStore)
+ {
+ var embeddableDocumentStore = documentStore as EmbeddableDocumentStore;
+ var errors = embeddableDocumentStore != null
+ ? embeddableDocumentStore.DocumentDatabase.Statistics.Errors
+ : documentStore.DatabaseCommands.GetStatistics().Errors;
+
+ try
+ {
+ Assert.Empty(errors);
+ }
+ catch (EmptyException)
+ {
+ Console.WriteLine(errors.First().Error);
+ throw;
+ }
+ }
}
}
View
148 Raven.Tests.Silverlight/Statistics.cs
@@ -1,75 +1,75 @@
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Microsoft.Silverlight.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Raven.Abstractions.Indexing;
-using Raven.Client.Document;
-using Raven.Client.Extensions;
-using Raven.Tests.Document;
-
-namespace Raven.Tests.Silverlight
-{
- public class Statistics : RavenTestBase
- {
- [Asynchronous]
- public IEnumerable<Task> CanRetrieveStatisticsForTheDefaultDatabase()
- {
- using (var documentStore = new DocumentStore {Url = Url + Port}.Initialize())
- {
- var getStats = documentStore.AsyncDatabaseCommands
- .GetStatisticsAsync();
- yield return getStats;
-
- Assert.IsNotNull(getStats.Result);
- }
- }
-
- [Asynchronous]
- public IEnumerable<Task> CanRetrieveStatisticsForADatabase()
- {
- var dbname = GenerateNewDatabaseName();
- using (var documentStore = new DocumentStore {Url = Url + Port}.Initialize())
- {
- yield return documentStore.AsyncDatabaseCommands.EnsureDatabaseExistsAsync(dbname);
-
- yield return documentStore.AsyncDatabaseCommands.ForDatabase(dbname).PutIndexAsync("test", new IndexDefinition
- {
- Map = "from doc in docs select new { doc.Name}"
- }, true);
-
- var getStats = documentStore.AsyncDatabaseCommands.ForDatabase(dbname).GetStatisticsAsync();
- yield return getStats;
-
- var stats = getStats.Result;
- Assert.AreEqual(0, stats.CountOfDocuments);
- Assert.IsTrue(stats.CountOfIndexes > 0);
- }
- }
-
- [Asynchronous]
- public IEnumerable<Task> StatisticsShouldNotBeCached()
- {
- var dbname = GenerateNewDatabaseName();
- using (var documentStore = new DocumentStore {Url = Url + Port}.Initialize())
- {
- yield return documentStore.AsyncDatabaseCommands.EnsureDatabaseExistsAsync(dbname);
-
- var getStats = documentStore.AsyncDatabaseCommands.ForDatabase(dbname).GetStatisticsAsync();
- yield return getStats;
-
- Assert.AreEqual(0, getStats.Result.CountOfDocuments);
-
- using (var session = documentStore.OpenAsyncSession(dbname))
- {
- session.Store(new Company {Name = "Change the Stats, Inc."});
- yield return session.SaveChangesAsync();
- }
-
- var verifyStats = documentStore.AsyncDatabaseCommands.ForDatabase(dbname).GetStatisticsAsync();
- yield return verifyStats;
-
- Assert.AreEqual(1, verifyStats.Result.CountOfDocuments);
- }
- }
- }
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Microsoft.Silverlight.Testing;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Raven.Abstractions.Indexing;
+using Raven.Client.Document;
+using Raven.Client.Extensions;
+using Raven.Tests.Document;
+
+namespace Raven.Tests.Silverlight
+{
+ public class Statistics : RavenTestBase
+ {
+ [Asynchronous]
+ public IEnumerable<Task> CanRetrieveStatisticsForTheDefaultDatabase()
+ {
+ using (var documentStore = new DocumentStore {Url = Url + Port}.Initialize())
+ {
+ var getStats = documentStore.AsyncDatabaseCommands
+ .GetStatisticsAsync();
+ yield return getStats;
+
+ Assert.IsNotNull(getStats.Result);
+ }
+ }
+
+ [Asynchronous]
+ public IEnumerable<Task> CanRetrieveStatisticsForADatabase()
+ {
+ var dbname = GenerateNewDatabaseName();
+ using (var documentStore = new DocumentStore {Url = Url + Port}.Initialize())
+ {
+ yield return documentStore.AsyncDatabaseCommands.EnsureDatabaseExistsAsync(dbname);
+
+ yield return documentStore.AsyncDatabaseCommands.ForDatabase(dbname).PutIndexAsync("test", new IndexDefinition
+ {
+ Map = "from doc in docs select new { doc.Name}"
+ }, true);
+
+ var getStats = documentStore.AsyncDatabaseCommands.ForDatabase(dbname).GetStatisticsAsync();
+ yield return getStats;
+
+ var stats = getStats.Result;
+ Assert.AreEqual(0, stats.CountOfDocuments);
+ Assert.IsTrue(stats.CountOfIndexes > 0);
+ }
+ }
+
+ [Asynchronous]
+ public IEnumerable<Task> StatisticsShouldNotBeCached()
+ {
+ var dbname = GenerateNewDatabaseName();
+ using (var documentStore = new DocumentStore {Url = Url + Port}.Initialize())
+ {
+ yield return documentStore.AsyncDatabaseCommands.EnsureDatabaseExistsAsync(dbname);
+
+ var getStats = documentStore.AsyncDatabaseCommands.ForDatabase(dbname).GetStatisticsAsync();
+ yield return getStats;
+
+ Assert.AreEqual(0, getStats.Result.CountOfDocuments);
+
+ using (var session = documentStore.OpenAsyncSession(dbname))
+ {
+ session.Store(new Company {Name = "Change the Stats, Inc."});
+ yield return session.SaveChangesAsync();
+ }
+
+ var verifyStats = documentStore.AsyncDatabaseCommands.ForDatabase(dbname).GetStatisticsAsync();
+ yield return verifyStats;
+
+ Assert.AreEqual(1, verifyStats.Result.CountOfDocuments);
+ }
+ }
+ }
}
View
324 Raven.Tests/Bugs/CS1977.cs
@@ -1,163 +1,163 @@
-using System.Collections.Generic;
-using System.Linq;
-using Raven.Client.Indexes;
-using Xunit;
-
-namespace Raven.Tests.Bugs
-{
- public class indexes_error_CS1977_Cannot_use_a_lambda_expression_from_reduce : RavenTest
- {
- public class Account
- {
- public string Id { get; set; }
- public string Name { get; set; }
- }
-
- public class User
- {
- public string AccountId { get; set; }
- public string Id { get; set; }
- public string Name { get; set; }
- }
-
- public class Design
- {
- public string AccountId { get; set; }
- public string Id { get; set; }
- public string Name { get; set; }
- }
-
- public class ReduceResult
- {
- public string DocumentType { get; set; }
- public string AccountId { get; set; }
- public string AccountName { get; set; }
- public IEnumerable<string> UserName { get; set; }
- public IEnumerable<string> DesignName { get; set; }
- }
-
- public class ComplexIndex : AbstractMultiMapIndexCreationTask<ReduceResult>
- {
- public ComplexIndex()
- {
- AddMap<Account>(accounts =>
- from account in accounts
- select new
- {
- DocumentType = "Account",
- AccountId = account.Id,
- AccountName = account.Name,
- DesignName = "",
- UserName = "",
- });
- AddMap<Design>(designs =>
- from design in designs
- select new
- {
- DocumentType = "Design",
- AccountId = design.AccountId,
- AccountName = "",
- DesignName = design.Name,
- UserName = "",
- });
- AddMap<User>(users =>
- from user in users
- select new
- {
- DocumentType = "User",
- AccountId = user.AccountId,
- AccountName = "",
- DesignName = "",
- UserName = user.Name,
- });
-
- Reduce = results =>
- from result in results
- group result by result.AccountId into accountGroup
- from account in accountGroup
- where account.DocumentType == "Account"
- select new
- {
- DocumentType = "Account",
- AccountId = account.AccountId,
- AccountName = account.AccountName,
- UserName = accountGroup.Where(x => x.DocumentType == "User").SelectMany(x => x.UserName),
- DesignName = accountGroup.Where(x => x.DocumentType == "Design").SelectMany(x => x.DesignName)
- };
- }
- }
-
- public class SelectIndex : AbstractMultiMapIndexCreationTask<ReduceResult>
- {
- public SelectIndex()
- {
- {
- AddMap<Account>(accounts =>
- from account in accounts
- select new
- {
- DocumentType = "Account",
- AccountId = account.Id,
- AccountName = account.Name,
- DesignName = "",
- UserName = "",
- });
- AddMap<Design>(designs =>
- from design in designs
- select new
- {
- DocumentType = "Design",
- AccountId = design.AccountId,
- AccountName = "",
- DesignName = design.Name,
- UserName = "",
- });
- AddMap<User>(users =>
- from user in users
- select new
- {
- DocumentType = "User",
- AccountId = user.AccountId,
- AccountName = "",
- DesignName = "",
- UserName = user.Name,
- });
-
- Reduce = results =>
- from result in results
- group result by result.AccountId into accountGroup
- from account in accountGroup
- where account.DocumentType == "Account"
- select new
- {
- DocumentType = "Account",
- AccountId = account.AccountId,
- AccountName = account.AccountName,
- UserName = accountGroup.Where(x => x.DocumentType == "User").Select(x => x.UserName),
- DesignName = accountGroup.Where(x => x.DocumentType == "Design").Select(x => x.DesignName)
- };
- }
- }
- }
-
-
- [Fact]
- public void can_create_index()
- {
- using (var store = NewDocumentStore())
- {
- new ComplexIndex().Execute(store);
- }
- }
-
-
- [Fact]
- public void can_create_index_where_reduce_uses_select()
- {
- using (var store = NewDocumentStore())
- {
- new SelectIndex().Execute(store);
- }
- }
- }
+using System.Collections.Generic;
+using System.Linq;
+using Raven.Client.Indexes;
+using Xunit;
+
+namespace Raven.Tests.Bugs
+{
+ public class indexes_error_CS1977_Cannot_use_a_lambda_expression_from_reduce : RavenTest
+ {
+ public class Account
+ {
+ public string Id { get; set; }
+ public string Name { get; set; }
+ }
+
+ public class User
+ {
+ public string AccountId { get; set; }
+ public string Id { get; set; }
+ public string Name { get; set; }
+ }
+
+ public class Design
+ {
+ public string AccountId { get; set; }
+ public string Id { get; set; }
+ public string Name { get; set; }
+ }
+
+ public class ReduceResult
+ {
+ public string DocumentType { get; set; }
+ public string AccountId { get; set; }
+ public string AccountName { get; set; }
+ public IEnumerable<string> UserName { get; set; }
+ public IEnumerable<string> DesignName { get; set; }
+ }
+
+ public class ComplexIndex : AbstractMultiMapIndexCreationTask<ReduceResult>
+ {
+ public ComplexIndex()
+ {
+ AddMap<Account>(accounts =>
+ from account in accounts
+ select new
+ {
+ DocumentType = "Account",
+ AccountId = account.Id,
+ AccountName = account.Name,
+ DesignName = "",
+ UserName = "",
+ });
+ AddMap<Design>(designs =>
+ from design in designs
+ select new
+ {
+ DocumentType = "Design",
+ AccountId = design.AccountId,
+ AccountName = "",
+ DesignName = design.Name,
+ UserName = "",
+ });
+ AddMap<User>(users =>
+ from user in users
+ select new
+ {
+ DocumentType = "User",
+ AccountId = user.AccountId,
+ AccountName = "",
+ DesignName = "",
+ UserName = user.Name,
+ });
+
+ Reduce = results =>
+ from result in results
+ group result by result.AccountId into accountGroup
+ from account in accountGroup
+ where account.DocumentType == "Account"
+ select new
+ {
+ DocumentType = "Account",
+ AccountId = account.AccountId,
+ AccountName = account.AccountName,
+ UserName = accountGroup.Where(x => x.DocumentType == "User").SelectMany(x => x.UserName),
+ DesignName = accountGroup.Where(x => x.DocumentType == "Design").SelectMany(x => x.DesignName)
+ };
+ }
+ }
+
+ public class SelectIndex : AbstractMultiMapIndexCreationTask<ReduceResult>
+ {
+ public SelectIndex()
+ {
+ {
+ AddMap<Account>(accounts =>
+ from account in accounts
+ select new
+ {
+ DocumentType = "Account",
+ AccountId = account.Id,
+ AccountName = account.Name,
+ DesignName = "",
+ UserName = "",
+ });
+ AddMap<Design>(designs =>
+ from design in designs
+ select new
+ {
+ DocumentType = "Design",
+ AccountId = design.AccountId,
+ AccountName = "",
+ DesignName = design.Name,
+ UserName = "",
+ });
+ AddMap<User>(users =>
+ from user in users
+ select new
+ {
+ DocumentType = "User",
+ AccountId = user.AccountId,
+ AccountName = "",
+ DesignName = "",
+ UserName = user.Name,
+ });
+
+ Reduce = results =>
+ from result in results
+ group result by result.AccountId into accountGroup
+ from account in accountGroup
+ where account.DocumentType == "Account"
+ select new
+ {
+ DocumentType = "Account",
+ AccountId = account.AccountId,
+ AccountName = account.AccountName,
+ UserName = accountGroup.Where(x => x.DocumentType == "User").Select(x => x.UserName),
+ DesignName = accountGroup.Where(x => x.DocumentType == "Design").Select(x => x.DesignName)
+ };
+ }
+ }
+ }
+
+
+ [Fact]
+ public void can_create_index()
+ {
+ using (var store = NewDocumentStore())
+ {
+ new ComplexIndex().Execute(store);
+ }
+ }
+
+
+ [Fact]
+ public void can_create_index_where_reduce_uses_select()
+ {
+ using (var store = NewDocumentStore())
+ {
+ new SelectIndex().Execute(store);
+ }
+ }
+ }
}
View
18 Raven.Tests/Bugs/CompiledIndexes/Network.cs
@@ -1,10 +1,10 @@
-using System;
-
-namespace Raven.Tests.Bugs.CompiledIndexes
-{
- public class Network
- {
- public string Id { get; set; }
- public DateTime TimeStamp { get; set; }
- }
+using System;
+
+namespace Raven.Tests.Bugs.CompiledIndexes
+{
+ public class Network
+ {
+ public string Id { get; set; }
+ public DateTime TimeStamp { get; set; }
+ }
}
View
20 Raven.Tests/Bugs/CompiledIndexes/NetworkList.cs
@@ -1,11 +1,11 @@
-using System;
-
-namespace Raven.Tests.Bugs.CompiledIndexes
-{
- public class NetworkList
- {
- public string Network { get; set; }
- public DateTime NetworkTimeStamp { get; set; }
- public Network NetworkDetail { get; set; }
- }
+using System;
+
+namespace Raven.Tests.Bugs.CompiledIndexes
+{
+ public class NetworkList
+ {
+ public string Network { get; set; }
+ public DateTime NetworkTimeStamp { get; set; }
+ public Network NetworkDetail { get; set; }
+ }
}
View
38 Raven.Tests/Bugs/ConnectionStringParsing.cs
@@ -1,20 +1,20 @@
-using Raven.Abstractions.Data;
-using Raven.Client.Document;
-using Xunit;
-
-namespace Raven.Tests.Bugs
-{
- public class ConnectionStringParsing
- {
- [Fact]
- public void EnsureWellFormedConnectionStrings_ParsingWithEndingSemicolons_Successful()
- {
- var connectionStringParser = ConnectionStringParser<RavenConnectionStringOptions>.FromConnectionString("Url=http://localhost:10301;");
- connectionStringParser.Parse();
- Assert.DoesNotContain(";", connectionStringParser.ConnectionStringOptions.Url);
- connectionStringParser = ConnectionStringParser<RavenConnectionStringOptions>.FromConnectionString("Url=http://localhost:10301/;");
- connectionStringParser.Parse();
- Assert.DoesNotContain(";", connectionStringParser.ConnectionStringOptions.Url);
- }
- }
+using Raven.Abstractions.Data;
+using Raven.Client.Document;
+using Xunit;
+
+namespace Raven.Tests.Bugs
+{
+ public class ConnectionStringParsing
+ {
+ [Fact]
+ public void EnsureWellFormedConnectionStrings_ParsingWithEndingSemicolons_Successful()
+ {
+ var connectionStringParser = ConnectionStringParser<RavenConnectionStringOptions>.FromConnectionString("Url=http://localhost:10301;");
+ connectionStringParser.Parse();
+ Assert.DoesNotContain(";", connectionStringParser.ConnectionStringOptions.Url);
+ connectionStringParser = ConnectionStringParser<RavenConnectionStringOptions>.FromConnectionString("Url=http://localhost:10301/;");
+ connectionStringParser.Parse();
+ Assert.DoesNotContain(";", connectionStringParser.ConnectionStringOptions.Url);
+ }
+ }
}
View
86 Raven.Tests/Bugs/DirectoryCreation.cs
@@ -1,44 +1,44 @@
-using System.IO;
-using System.Linq;
-using Raven.Client.Embedded;
-using Raven.Database.Extensions;
-using Xunit;
-
-namespace Raven.Tests.Bugs
-{
- public class DirectoryCreation
- {
- [Fact]
- public void ShouldOnlyBeInDataDir()
- {
- IOExtensions.DeleteDirectory("App_Data");
- IOExtensions.DeleteDirectory("Data");
-
- Assert.False(Directory.Exists("App_Data"));
- Assert.False(Directory.Exists("Data"));
-
-
- using (var store = new EmbeddableDocumentStore {DataDirectory = "App_Data"}.Initialize())
- {
- using (var session = store.OpenSession())
- {
- string someEmail = "e@d.com";
- session.Query<User>().Where(u => u.Email == someEmail).FirstOrDefault();
- session.Store(new User {Email = "e@d.com"});
- session.SaveChanges();
- session.Query<User>()
- .Customize(x => x.WaitForNonStaleResultsAsOfNow())
- .Where(u => u.Email == someEmail)
- .Single();
- }
- }
-
- Assert.True(Directory.Exists("App_Data"));
- Assert.False(Directory.Exists("Data"));
-
- IOExtensions.DeleteDirectory("App_Data");
- IOExtensions.DeleteDirectory("Data");
-
- }
- }
+using System.IO;
+using System.Linq;
+using Raven.Client.Embedded;
+using Raven.Database.Extensions;
+using Xunit;
+
+namespace Raven.Tests.Bugs
+{
+ public class DirectoryCreation
+ {
+ [Fact]
+ public void ShouldOnlyBeInDataDir()
+ {
+ IOExtensions.DeleteDirectory("App_Data");
+ IOExtensions.DeleteDirectory("Data");
+
+ Assert.False(Directory.Exists("App_Data"));
+ Assert.False(Directory.Exists("Data"));
+
+
+ using (var store = new EmbeddableDocumentStore {DataDirectory = "App_Data"}.Initialize())
+ {
+ using (var session = store.OpenSession())
+ {
+ string someEmail = "e@d.com";
+ session.Query<User>().Where(u => u.Email == someEmail).FirstOrDefault();
+ session.Store(new User {Email = "e@d.com"});
+ session.SaveChanges();
+ session.Query<User>()
+ .Customize(x => x.WaitForNonStaleResultsAsOfNow())
+ .Where(u => u.Email == someEmail)
+ .Single();
+ }
+ }
+
+ Assert.True(Directory.Exists("App_Data"));
+ Assert.False(Directory.Exists("Data"));
+
+ IOExtensions.DeleteDirectory("App_Data");
+ IOExtensions.DeleteDirectory("Data");
+
+ }
+ }
}
View
16 Raven.Tests/Bugs/EntityWithNullableDateTimeOffset.cs
@@ -1,9 +1,9 @@
-using System;
-
-namespace Raven.Tests.Bugs
-{
- public class EntityWithNullableDateTimeOffset
- {
- public DateTimeOffset? At { get; set; }
- }
+using System;
+
+namespace Raven.Tests.Bugs
+{
+ public class EntityWithNullableDateTimeOffset
+ {
+ public DateTimeOffset? At { get; set; }
+ }
}
View
38 Raven.Tests/Bugs/FailDelete.cs
@@ -1,20 +1,20 @@
-//-----------------------------------------------------------------------
-// <copyright file="FailDelete.cs" company="Hibernating Rhinos LTD">
-// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-using System;
-using Raven.Client;
-using Raven.Client.Listeners;
-using Raven.Json.Linq;
-
-namespace Raven.Tests.Bugs
-{
- public class FailDelete : IDocumentDeleteListener
- {
- public void BeforeDelete(string key, object entityInstance, RavenJObject metadata)
- {
- throw new NotImplementedException();
- }
- }
+//-----------------------------------------------------------------------
+// <copyright file="FailDelete.cs" company="Hibernating Rhinos LTD">
+// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+using System;
+using Raven.Client;
+using Raven.Client.Listeners;
+using Raven.Json.Linq;
+
+namespace Raven.Tests.Bugs
+{
+ public class FailDelete : IDocumentDeleteListener
+ {
+ public void BeforeDelete(string key, object entityInstance, RavenJObject metadata)
+ {
+ throw new NotImplementedException();
+ }
+ }
}
View
48 Raven.Tests/Bugs/FailStore.cs
@@ -1,25 +1,25 @@
-//-----------------------------------------------------------------------
-// <copyright file="FailStore.cs" company="Hibernating Rhinos LTD">
-// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-using System;
-using Raven.Client;
-using Raven.Client.Listeners;
-using Raven.Json.Linq;
-
-namespace Raven.Tests.Bugs
-{
- public class FailStore : IDocumentStoreListener
- {
- public bool BeforeStore(string key, object entityInstance, RavenJObject metadata, RavenJObject original)
- {
- throw new NotImplementedException();
- }
-
- public void AfterStore(string key, object entityInstance, RavenJObject metadata)
- {
- throw new NotImplementedException();
- }
- }
+//-----------------------------------------------------------------------
+// <copyright file="FailStore.cs" company="Hibernating Rhinos LTD">
+// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+using System;
+using Raven.Client;
+using Raven.Client.Listeners;
+using Raven.Json.Linq;
+
+namespace Raven.Tests.Bugs
+{
+ public class FailStore : IDocumentStoreListener
+ {
+ public bool BeforeStore(string key, object entityInstance, RavenJObject metadata, RavenJObject original)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void AfterStore(string key, object entityInstance, RavenJObject metadata)
+ {
+ throw new NotImplementedException();
+ }
+ }
}
View
268 Raven.Tests/Bugs/Identifiers/SpecialCharactersOnIIS.cs
@@ -1,135 +1,135 @@
-// //-----------------------------------------------------------------------
-// // <copyright company="Hibernating Rhinos LTD">
-// // Copyright (c) Hibernating Rhinos LTD. All rights reserved.
-// // </copyright>
-// //-----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Reflection;
-using System.Security.Principal;
-using Raven.Client.Document;
-using Xunit;
-using Xunit.Extensions;
-using Xunit.Sdk;
-
-namespace Raven.Tests.Bugs.Identifiers
-{
- [CLSCompliant(false)]
- public class SpecialCharactersOnIIS : WithNLog
- {
- [IISExpressInstalledTheory]
- [InlineData("foo")]
- [InlineData("SHA1-UdVhzPmv0o+wUez+Jirt0OFBcUY=")]
- public void Can_load_entity(string entityId)
- {
- using (var testContext = new IisExpressTestClient())
- {
- using (var store = testContext.NewDocumentStore())
- {
- store.Initialize();
-
- using (var session = store.OpenSession())
- {
- var entity = new WithBase64Characters.Entity { Id = entityId };
- session.Store(entity);
- session.SaveChanges();
- }
-
- using (var session = store.OpenSession())
- {
- var entity1 = session.Load<object>(entityId);
- Assert.NotNull(entity1);
- }
- }
- }
- }
-
- #region Nested type: Entity
-
- public class Entity
- {
- public string Id { get; set; }
- }
-
- #endregion
- }
-
- [CLSCompliant(false)]
- public class IISExpressInstalledTheoryAttribute : TheoryAttribute
- {
- protected override IEnumerable<ITestCommand> EnumerateTestCommands(IMethodInfo method)
- {
- var displayName = method.TypeName + "." + method.Name;
-
- if (File.Exists(@"c:\Program Files (x86)\IIS Express\iisexpress.exe") == false && File.Exists(@"c:\Program Files\IIS Express\iisexpress.exe") == false)
- {
- yield return
- new SkipCommand(method, displayName,
- "Could not execute " + displayName + " because it requires IIS Express and could not find it at c:\\Program Files (x86)\\. or at c:\\Program Files\\. Considering installing the MSI from http://www.microsoft.com/download/en/details.aspx?id=1038");
- yield break;
- }
-
- foreach (var command in base.EnumerateTestCommands(method))
- {
- yield return command;
- }
- }
- }
-
- [CLSCompliant(false)]
- public class IISExpressInstalledFactAttribute : FactAttribute
- {
- protected override IEnumerable<ITestCommand> EnumerateTestCommands(IMethodInfo method)
- {
- var displayName = method.TypeName + "." + method.Name;
-
- if (File.Exists(@"c:\Program Files (x86)\IIS Express\iisexpress.exe") == false && File.Exists(@"c:\Program Files\IIS Express\iisexpress.exe") == false)
- {
- yield return
- new SkipCommand(method, displayName,
- "Could not execute " + displayName + " because it requires IIS Express and could not find it at c:\\Program Files (x86)\\. or at c:\\Program Files\\. Considering installing the MSI from http://www.microsoft.com/download/en/details.aspx?id=1038");
- yield break;
- }
-
- foreach (var command in base.EnumerateTestCommands(method))
- {
- yield return command;
- }
- }
- }
-
- [CLSCompliant(false)]
- public class AdminOnlyWithIIS7Installed : TheoryAttribute
- {
- protected override IEnumerable<ITestCommand> EnumerateTestCommands(IMethodInfo method)
- {
- var displayName = method.TypeName + "." + method.Name;
-
- if (File.Exists(@"C:\Windows\System32\InetSrv\Microsoft.Web.Administration.dll") == false)
- {
- yield return
- new SkipCommand(method, displayName,
- "Could not execute " + displayName + " because it requires IIS7 and could not find Microsoft.Web.Administration");
- yield break;
- }
-
- var windowsIdentity = WindowsIdentity.GetCurrent();
- if (windowsIdentity != null)
- {
- if (new WindowsPrincipal(windowsIdentity).IsInRole(WindowsBuiltInRole.Administrator) == false)
- {
- yield return
- new SkipCommand(method, displayName,
- "Could not execute " + displayName + " because it requires Admin privileges");
- yield break;
- }
- }
-
- foreach (var command in base.EnumerateTestCommands(method))
- {
- yield return command;
- }
- }
- }
+// //-----------------------------------------------------------------------
+// // <copyright company="Hibernating Rhinos LTD">
+// // Copyright (c) Hibernating Rhinos LTD. All rights reserved.
+// // </copyright>
+// //-----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using System.Security.Principal;
+using Raven.Client.Document;
+using Xunit;
+using Xunit.Extensions;
+using Xunit.Sdk;
+
+namespace Raven.Tests.Bugs.Identifiers
+{
+ [CLSCompliant(false)]
+ public class SpecialCharactersOnIIS : WithNLog
+ {
+ [IISExpressInstalledTheory]
+ [InlineData("foo")]
+ [InlineData("SHA1-UdVhzPmv0o+wUez+Jirt0OFBcUY=")]
+ public void Can_load_entity(string entityId)
+ {
+ using (var testContext = new IisExpressTestClient())
+ {
+ using (var store = testContext.NewDocumentStore())
+ {
+ store.Initialize();
+
+ using (var session = store.OpenSession())
+ {
+ var entity = new WithBase64Characters.Entity { Id = entityId };
+ session.Store(entity);
+ session.SaveChanges();
+ }
+
+ using (var session = store.OpenSession())
+ {
+ var entity1 = session.Load<object>(entityId);
+ Assert.NotNull(entity1);
+ }
+ }
+ }
+ }
+
+ #region Nested type: Entity
+
+ public class Entity
+ {
+ public string Id { get; set; }
+ }
+
+ #endregion
+ }
+
+ [CLSCompliant(false)]
+ public class IISExpressInstalledTheoryAttribute : TheoryAttribute
+ {
+ protected override IEnumerable<ITestCommand> EnumerateTestCommands(IMethodInfo method)
+ {
+ var displayName = method.TypeName + "." + method.Name;
+
+ if (File.Exists(@"c:\Program Files (x86)\IIS Express\iisexpress.exe") == false && File.Exists(@"c:\Program Files\IIS Express\iisexpress.exe") == false)
+ {
+ yield return
+ new SkipCommand(method, displayName,
+ "Could not execute " + displayName + " because it requires IIS Express and could not find it at c:\\Program Files (x86)\\. or at c:\\Program Files\\. Considering installing the MSI from http://www.microsoft.com/download/en/details.aspx?id=1038");
+ yield break;
+ }
+
+ foreach (var command in base.EnumerateTestCommands(method))
+ {
+ yield return command;
+ }
+ }
+ }
+
+ [CLSCompliant(false)]
+ public class IISExpressInstalledFactAttribute : FactAttribute
+ {
+ protected override IEnumerable<ITestCommand> EnumerateTestCommands(IMethodInfo method)
+ {
+ var displayName = method.TypeName + "." + method.Name;
+
+ if (File.Exists(@"c:\Program Files (x86)\IIS Express\iisexpress.exe") == false && File.Exists(@"c:\Program Files\IIS Express\iisexpress.exe") == false)
+ {
+ yield return
+ new SkipCommand(method, displayName,
+ "Could not execute " + displayName + " because it requires IIS Express and could not find it at c:\\Program Files (x86)\\. or at c:\\Program Files\\. Considering installing the MSI from http://www.microsoft.com/download/en/details.aspx?id=1038");
+ yield break;
+ }
+
+ foreach (var command in base.EnumerateTestCommands(method))
+ {
+ yield return command;
+ }
+ }
+ }
+
+ [CLSCompliant(false)]
+ public class AdminOnlyWithIIS7Installed : TheoryAttribute
+ {
+ protected override IEnumerable<ITestCommand> EnumerateTestCommands(IMethodInfo method)
+ {
+ var displayName = method.TypeName + "." + method.Name;
+
+ if (File.Exists(@"C:\Windows\System32\InetSrv\Microsoft.Web.Administration.dll") == false)
+ {
+ yield return
+ new SkipCommand(method, displayName,
+ "Could not execute " + displayName + " because it requires IIS7 and could not find Microsoft.Web.Administration");
+ yield break;
+ }
+
+ var windowsIdentity = WindowsIdentity.GetCurrent();
+ if (windowsIdentity != null)
+ {
+ if (new WindowsPrincipal(windowsIdentity).IsInRole(WindowsBuiltInRole.Administrator) == false)
+ {
+ yield return
+ new SkipCommand(method, displayName,
+ "Could not execute " + displayName + " because it requires Admin privileges");
+ yield break;
+ }
+ }
+
+ foreach (var command in base.EnumerateTestCommands(method))
+ {
+ yield return command;
+ }
+ }
+ }
}
View
24 Raven.Tests/Bugs/Image.cs
@@ -1,13 +1,13 @@
-//-----------------------------------------------------------------------
-// <copyright file="Image.cs" company="Hibernating Rhinos LTD">
-// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-namespace Raven.Tests.Bugs
-{
- public class Image
- {
- public string Id { get; set; }
- public string[] Tags { get; set; }
- }
+//-----------------------------------------------------------------------
+// <copyright file="Image.cs" company="Hibernating Rhinos LTD">
+// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+namespace Raven.Tests.Bugs
+{
+ public class Image
+ {
+ public string Id { get; set; }
+ public string[] Tags { get; set; }
+ }
}
View
24 Raven.Tests/Bugs/ImageByTagSearchModel.cs
@@ -1,13 +1,13 @@
-//-----------------------------------------------------------------------
-// <copyright file="ImageByTagSearchModel.cs" company="Hibernating Rhinos LTD">
-// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-namespace Raven.Tests.Bugs
-{
- public class ImageByTagSearchModel
- {
- public string TagName { get; set; }
- public string[] Images { get; set; }
- }
+//-----------------------------------------------------------------------
+// <copyright file="ImageByTagSearchModel.cs" company="Hibernating Rhinos LTD">
+// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+namespace Raven.Tests.Bugs
+{
+ public class ImageByTagSearchModel
+ {
+ public string TagName { get; set; }
+ public string[] Images { get; set; }
+ }
}
View
76 Raven.Tests/Bugs/InMemoryOnly.cs
@@ -1,39 +1,39 @@
-//-----------------------------------------------------------------------
-// <copyright file="InMemoryOnly.cs" company="Hibernating Rhinos LTD">
-// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-using System.IO;
-using Raven.Client.Embedded;
-using Raven.Database.Extensions;
-using Raven.Database.Server;
-using Xunit;
-
-namespace Raven.Tests.Bugs
-{
- public class InMemoryOnly
- {
- [Fact]
- public void InMemoryDoesNotCreateDataDir()
- {
- IOExtensions.DeleteDirectory("Data");
-
- NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8079);
- using (var store = new EmbeddableDocumentStore
- {
- RunInMemory = true,
- UseEmbeddedHttpServer = true,
- Configuration =
- {
- Port = 8079,
- RunInMemory = true
- }
- })
- {
- store.Initialize();
-
- Assert.False(Directory.Exists("Data"));
- }
- }
- }
+//-----------------------------------------------------------------------
+// <copyright file="InMemoryOnly.cs" company="Hibernating Rhinos LTD">
+// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+using System.IO;
+using Raven.Client.Embedded;
+using Raven.Database.Extensions;
+using Raven.Database.Server;
+using Xunit;
+
+namespace Raven.Tests.Bugs
+{
+ public class InMemoryOnly
+ {
+ [Fact]
+ public void InMemoryDoesNotCreateDataDir()
+ {
+ IOExtensions.DeleteDirectory("Data");
+
+ NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8079);
+ using (var store = new EmbeddableDocumentStore
+ {
+ RunInMemory = true,
+ UseEmbeddedHttpServer = true,
+ Configuration =
+ {
+ Port = 8079,
+ RunInMemory = true
+ }
+ })
+ {
+ store.Initialize();
+
+ Assert.False(Directory.Exists("Data"));
+ }
+ }
+ }
}
View
94 Raven.Tests/Bugs/IndexDefinitionEquality.cs
@@ -1,47 +1,47 @@
-//-----------------------------------------------------------------------
-// <copyright file="IndexDefinitionEquality.cs" company="Hibernating Rhinos LTD">
-// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Raven.Abstractions.Indexing;
-using Xunit;
-using Raven.Database.Indexing;
-using Raven.Client.Indexes;
-
-namespace Raven.Tests.Bugs
-{
- public class IndexDefinitionEquality
- {
- [Fact]
- public void TransformResultsFactoredIntoEqualityCheck()
- {
- IndexDefinition definitionOne = new IndexDefinitionBuilder<Blog, Blog>()
- {
- Map = docs => from doc in docs
- select new { doc.Property },
- TransformResults = (database, results) => from result in results
- select new
- {
- Property = result.Property
- }
- }.ToIndexDefinition(new Client.Document.DocumentConvention());
-
- IndexDefinition definitionTwo = new IndexDefinitionBuilder<Blog, Blog>()
- {
- Map = docs => from doc in docs
- select new { doc.Property }
- }.ToIndexDefinition(new Client.Document.DocumentConvention());
-
- Assert.False(definitionOne.Equals(definitionTwo));
- }
-
- public class Blog
- {
- public string Property { get; set; }
- }
- }
-}
+//-----------------------------------------------------------------------
+// <copyright file="IndexDefinitionEquality.cs" company="Hibernating Rhinos LTD">
+// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Raven.Abstractions.Indexing;
+using Xunit;
+using Raven.Database.Indexing;
+using Raven.Client.Indexes;
+
+namespace Raven.Tests.Bugs
+{
+ public class IndexDefinitionEquality
+ {
+ [Fact]
+ public void TransformResultsFactoredIntoEqualityCheck()
+ {
+ IndexDefinition definitionOne = new IndexDefinitionBuilder<Blog, Blog>()
+ {
+ Map = docs => from doc in docs
+ select new { doc.Property },
+ TransformResults = (database, results) => from result in results
+ select new
+ {
+ Property = result.Property
+ }
+ }.ToIndexDefinition(new Client.Document.DocumentConvention());
+
+ IndexDefinition definitionTwo = new IndexDefinitionBuilder<Blog, Blog>()
+ {
+ Map = docs => from doc in docs
+ select new { doc.Property }
+ }.ToIndexDefinition(new Client.Document.DocumentConvention());
+
+ Assert.False(definitionOne.Equals(definitionTwo));
+ }
+
+ public class Blog
+ {
+ public string Property { get; set; }
+ }
+ }
+}
View
12 Raven.Tests/Bugs/Indexing/Transaction.cs
@@ -1,7 +1,7 @@
-namespace Raven.Tests.Bugs.Indexing
-{
- public class Transaction
- {
- public string MRN { get; set; }
- }
+namespace Raven.Tests.Bugs.Indexing
+{
+ public class Transaction
+ {
+ public string MRN { get; set; }
+ }
}
View
34 Raven.Tests/Bugs/Indexing/Transaction_ByMrn.cs
@@ -1,18 +1,18 @@
-using System.Linq;
-using Raven.Client.Indexes;
-
-namespace Raven.Tests.Bugs.Indexing
-{
- public class Transaction_ByMrn : AbstractIndexCreationTask<Transaction>
- {
- public Transaction_ByMrn()
- {
- Map = transactions => from transaction in transactions
- select new
- {
- MRN =
- transaction.MRN
- };
- }
- }
+using System.Linq;
+using Raven.Client.Indexes;
+
+namespace Raven.Tests.Bugs.Indexing
+{
+ public class Transaction_ByMrn : AbstractIndexCreationTask<Transaction>
+ {
+ public Transaction_ByMrn()
+ {
+ Map = transactions => from transaction in transactions
+ select new
+ {
+ MRN =
+ transaction.MRN
+ };
+ }
+ }
}
View
102 Raven.Tests/Bugs/LinqOnUrls.cs
@@ -1,52 +1,52 @@
-//-----------------------------------------------------------------------
-// <copyright file="LinqOnUrls.cs" company="Hibernating Rhinos LTD">
-// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-using System;
-using Raven.Client.Document;
-using Raven.Database.Extensions;
-using Raven.Database.Server;
-using Xunit;
-using System.Linq;
-
-namespace Raven.Tests.Bugs
-{
- public class LinqOnUrls : RemoteClientTest, IDisposable
- {
- private readonly string path;
- private readonly int port;
-
- public LinqOnUrls()
- {
- port = 8079;
- path = GetPath("TestDb");
- NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8079);
- }
-
-
- public override void Dispose()
- {
- IOExtensions.DeleteDirectory(path);
- base.Dispose();
- }
-
- [Fact]
- public void CanQueryUrlsValuesUsingLinq()
- {
- using (GetNewServer(port, path))
- {
- using (var documentStore = new DocumentStore { Url = "http://localhost:" + port })
- {
- documentStore.Initialize();
-
- var documentSession = documentStore.OpenSession();
-
- documentSession.Query<User>().Where(
- x => x.Name == "http://www.idontexistinthecacheatall.com?test=xxx&gotcha=1")
- .FirstOrDefault();
- }
- }
- }
- }
+//-----------------------------------------------------------------------
+// <copyright file="LinqOnUrls.cs" company="Hibernating Rhinos LTD">
+// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+using System;
+using Raven.Client.Document;
+using Raven.Database.Extensions;
+using Raven.Database.Server;
+using Xunit;
+using System.Linq;
+
+namespace Raven.Tests.Bugs
+{
+ public class LinqOnUrls : RemoteClientTest, IDisposable
+ {
+ private readonly string path;
+ private readonly int port;
+
+ public LinqOnUrls()
+ {
+ port = 8079;
+ path = GetPath("TestDb");
+ NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8079);
+ }
+
+
+ public override void Dispose()
+ {
+ IOExtensions.DeleteDirectory(path);
+ base.Dispose();
+ }
+
+ [Fact]
+ public void CanQueryUrlsValuesUsingLinq()
+ {
+ using (GetNewServer(port, path))
+ {
+ using (var documentStore = new DocumentStore { Url = "http://localhost:" + port })
+ {
+ documentStore.Initialize();
+
+ var documentSession = documentStore.OpenSession();
+
+ documentSession.Query<User>().Where(
+ x => x.Name == "http://www.idontexistinthecacheatall.com?test=xxx&gotcha=1")
+ .FirstOrDefault();
+ }
+ }
+ }
+ }
}
View
16 Raven.Tests/Bugs/LiveProjections/Entities/Place.cs
@@ -1,9 +1,9 @@
-namespace Raven.Tests.Bugs.LiveProjections.Entities
-{
- public class Place
- {
- public int Id { get; set; }
-
- public string Name { get; set; }
- }
+namespace Raven.Tests.Bugs.LiveProjections.Entities
+{
+ public class Place
+ {
+ public int Id { get; set; }
+
+ public string Name { get; set; }
+ }
}
View
24 Raven.Tests/Bugs/LiveProjections/Entities/Product.cs
@@ -1,13 +1,13 @@
-namespace Raven.Tests.Bugs.LiveProjections.Entities
-{
- using System.Collections.Generic;
-
- public class Product
- {
- public string Id { get; set; }
-
- public string Name { get; set; }
-
- public ICollection<ProductSku> Variants { get; set; }
- }
+namespace Raven.Tests.Bugs.LiveProjections.Entities
+{
+ using System.Collections.Generic;
+
+ public class Product
+ {
+ public string Id { get; set; }
+
+ public string Name { get; set; }
+
+ public ICollection<ProductSku> Variants { get; set; }
+ }
}
View
28 Raven.Tests/Bugs/LiveProjections/Entities/ProductSku.cs
@@ -1,15 +1,15 @@
-namespace Raven.Tests.Bugs.LiveProjections.Entities
-{
- public class ProductSku
- {
- public string Id { get; set; }
-
- public string ArticleNumber { get; set; }
-
- public string Name { get; set; }
-
- public string Packing { get; set; }
-
- public int QuantityInWarehouse { get; set; }
- }
+namespace Raven.Tests.Bugs.LiveProjections.Entities
+{
+ public class ProductSku
+ {
+ public string Id { get; set; }
+
+ public string ArticleNumber { get; set; }
+
+ public string Name { get; set; }
+
+ public string Packing { get; set; }
+
+ public int QuantityInWarehouse { get; set; }
+ }
}
View
40 Raven.Tests/Bugs/LiveProjections/Entities/Task.cs
@@ -1,21 +1,21 @@
-using System;
-
-namespace Raven.Tests.Bugs.LiveProjections.Entities
-{
- public class Task
- {
- public long Id { get; set; }
-
- public string Description { get; set; }
-
- public DateTime Start { get; set; }
-
- public DateTime End { get; set; }
-
- public int GiverId { get; set; }
-
- public int TakerId { get; set; }
-
- public int PlaceId { get; set; }
- }
+using System;
+
+namespace Raven.Tests.Bugs.LiveProjections.Entities
+{
+ public class Task
+ {
+ public long Id { get; set; }
+
+ public string Description { get; set; }
+
+ public DateTime Start { get; set; }
+
+ public DateTime End { get; set; }
+
+ public int GiverId { get; set; }
+
+ public int TakerId { get; set; }
+
+ public int PlaceId { get; set; }
+ }
}
View
52 Raven.Tests/Bugs/LiveProjections/Entities/TaskSummary.cs
@@ -1,27 +1,27 @@
-using System;
-
-namespace Raven.Tests.Bugs.LiveProjections.Entities
-{
- public class TaskSummary
- {
- public string Id { get; set; }
-
- public string Description { get; set; }
-
- public DateTime Start { get; set; }
-
- public DateTime End { get; set; }
-
- public int GiverId { get; set; }
-
- public string GiverName { get; set; }
-
- public int TakerId { get; set; }
-
- public string TakerName { get; set; }
-
- public int PlaceId { get; set; }
-
- public string PlaceName { get; set; }
- }
+using System;
+
+namespace Raven.Tests.Bugs.LiveProjections.Entities
+{
+ public class TaskSummary
+ {
+ public string Id { get; set; }
+
+ public string Description { get; set; }
+
+ public DateTime Start { get; set; }
+
+ public DateTime End { get; set; }
+
+ public int GiverId { get; set; }
+
+ public string GiverName { get; set; }
+
+ public int TakerId { get; set; }
+
+ public string TakerName { get; set; }
+
+ public int PlaceId { get; set; }
+
+ public string PlaceName { get; set; }
+ }
}
View
16 Raven.Tests/Bugs/LiveProjections/Entities/User.cs
@@ -1,9 +1,9 @@
-namespace Raven.Tests.Bugs.LiveProjections.Entities
-{
- public class User
- {
- public int Id { get; set; }
-
- public string Name { get; set; }
- }
+namespace Raven.Tests.Bugs.LiveProjections.Entities
+{
+ public class User
+ {
+ public int Id { get; set; }
+
+ public string Name { get; set; }
+ }
}
View
72 Raven.Tests/Bugs/LiveProjections/Indexes/ProductDetailsReport_ByProductId.cs
@@ -1,37 +1,37 @@
-namespace Raven.Tests.Bugs.LiveProjections.Indexes
-{
- using System.Linq;
-
- using Raven.Client.Indexes;
- using Raven.Tests.Bugs.LiveProjections.Entities;
- using Raven.Tests.Bugs.LiveProjections.Views;
-
- public class ProductDetailsReport_ByProductId : AbstractIndexCreationTask<Product, ProductDetailsReport>
- {
- public ProductDetailsReport_ByProductId()
- {
- Map = products => from product in products
- select new
- {
- ProductId = product.Id,
- };
-
- TransformResults = (database, results) =>
- from result in results
- let product = database.Load<Product>(result.Id)
- let variants = product.Variants
- select new
- {
- result.Id,
- Name = product.Name,
- Variants = variants.Select(x => new
- {
- x.ArticleNumber,
- x.Name,
- x.Packing,
- IsInStock = x.QuantityInWarehouse > 0
- })
- };
- }
- }
+namespace Raven.Tests.Bugs.LiveProjections.Indexes
+{
+ using System.Linq;
+
+ using Raven.Client.Indexes;
+ using Raven.Tests.Bugs.LiveProjections.Entities;
+ using Raven.Tests.Bugs.LiveProjections.Views;
+
+ public class ProductDetailsReport_ByProductId : AbstractIndexCreationTask<Product, ProductDetailsReport>
+ {
+ public ProductDetailsReport_ByProductId()
+ {
+ Map = products => from product in products
+ select new
+ {
+ ProductId = product.Id,
+ };
+
+ TransformResults = (database, results) =>
+ from result in results
+ let product = database.Load<Product>(result.Id)
+ let variants = product.Variants
+ select new
+ {
+ result.Id,
+ Name = product.Name,
+ Variants = variants.Select(x => new
+ {
+ x.ArticleNumber,
+ x.Name,
+ x.Packing,
+ IsInStock = x.QuantityInWarehouse > 0
+ })
+ };
+ }
+ }
}
View
92 Raven.Tests/Bugs/LiveProjections/Indexes/ProductSkuListViewModelReport_ByArticleNumberAndName.cs
@@ -1,47 +1,47 @@
-using Raven.Abstractions.Indexing;
-
-namespace Raven.Tests.Bugs.LiveProjections.Indexes
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Linq.Expressions;
-
- using Raven.Client.Indexes;
- using Raven.Database.Indexing;
- using Raven.Tests.Bugs.LiveProjections.Entities;
- using Raven.Tests.Bugs.LiveProjections.Views;
-
- public class ProductSkuListViewModelReport_ByArticleNumberAndName : AbstractIndexCreationTask<ProductSku, ProductSkuListViewModelReport>
- {
- public ProductSkuListViewModelReport_ByArticleNumberAndName()
- {
- Map = products => from product in products
- select new
- {
- Id = product.Id,
- ArticleNumber = product.ArticleNumber,
- Name = product.Name
- };
-
- TransformResults = (database, results) =>
- from result in results
- let product = database.Load<ProductSku>(result.Id)
- let stock = database.Load<ProductSku>(result.Id)
- select new
- {
- result.Id,
- result.ArticleNumber,
- result.Name,
- product.Packing,
- stock.QuantityInWarehouse
- };
-
- Indexes = new Dictionary<Expression<Func<ProductSkuListViewModelReport, object>>, FieldIndexing>()
- {
- { e=>e.ArticleNumber, FieldIndexing.Analyzed},
- { e=>e.Name, FieldIndexing.Analyzed}
- };
- }
- }
+using Raven.Abstractions.Indexing;
+
+namespace Raven.Tests.Bugs.LiveProjections.Indexes
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Linq.Expressions;
+
+ using Raven.Client.Indexes;
+ using Raven.Database.Indexing;
+ using Raven.Tests.Bugs.LiveProjections.Entities;
+ using Raven.Tests.Bugs.LiveProjections.Views;
+
+ public class ProductSkuListViewModelReport_ByArticleNumberAndName : AbstractIndexCreationTask<ProductSku, ProductSkuListViewModelReport>
+ {
+ public ProductSkuListViewModelReport_ByArticleNumberAndName()
+ {
+ Map = products => from product in products
+ select new
+ {
+ Id = product.Id,
+ ArticleNumber = product.ArticleNumber,
+ Name = product.Name
+ };
+
+ TransformResults = (database, results) =>
+ from result in results
+ let product = database.Load<ProductSku>(result.Id)
+ let stock = database.Load<ProductSku>(result.Id)
+ select new
+ {
+ result.Id,
+ result.ArticleNumber,
+ result.Name,
+ product.Packing,
+ stock.QuantityInWarehouse
+ };
+
+ Indexes = new Dictionary<Expression<Func<ProductSkuListViewModelReport, object>>, FieldIndexing>()
+ {
+ { e=>e.ArticleNumber, FieldIndexing.Analyzed},
+ { e=>e.Name, FieldIndexing.Analyzed}
+ };
+ }
+ }
}
View
68 Raven.Tests/Bugs/LiveProjections/Indexes/TaskSummaryIndex.cs
@@ -1,35 +1,35 @@
-using System.Linq;
-using Raven.Client.Indexes;
-using Raven.Tests.Bugs.LiveProjections.Entities;
-
-namespace Raven.Tests.Bugs.LiveProjections.Indexes
-{
- public class TaskSummaryIndex : AbstractIndexCreationTask<Task, TaskSummary>
- {
- public TaskSummaryIndex()
- {
- Map = docs => from t in docs
- select new { t.Start };
-
- TransformResults = (database, results) => from result in results
- let giver = database.Load<Raven.Tests.Bugs.LiveProjections.Entities.User>("users/" + result.GiverId)
- let taker = database.Load<Raven.Tests.Bugs.LiveProjections.Entities.User>("users/" + result.TakerId)
- let place = database.Load<Place>("places/" + result.PlaceId)
- select new
- {
- Id = result.Id,
- Description = result.Description,
- Start = result.Start,
- End = result.End,
- GiverId = result.GiverId,
- GiverName = giver.Name,
- TakerId = result.TakerId,
- TakerName = taker != null ? taker.Name : null,
- PlaceId = result.PlaceId,
- PlaceName = place.Name
- };
-
- IndexSortOptions.Add(s => s.Start, Raven.Abstractions.Indexing.SortOptions.String);
- }
- }
+using System.Linq;
+using Raven.Client.Indexes;
+using Raven.Tests.Bugs.LiveProjections.Entities;
+
+namespace Raven.Tests.Bugs.LiveProjections.Indexes
+{
+ public class TaskSummaryIndex : AbstractIndexCreationTask<Task, TaskSummary>
+ {
+ public TaskSummaryIndex()
+ {
+ Map = docs => from t in docs
+ select new { t.Start };
+
+ TransformResults = (database, results) => from result in results
+ let giver = database.Load<Raven.Tests.Bugs.LiveProjections.Entities.User>("users/" + result.GiverId)
+ let taker = database.Load<Raven.Tests.Bugs.LiveProjections.Entities.User>("users/" + result.TakerId)
+ let place = database.Load<Place>("places/" + result.PlaceId)
+ select new
+ {
+ Id = result.Id,
+ Description = result.Description,
+ Start = result.Start,
+ End = result.End,
+ GiverId = result.GiverId,
+ GiverName = giver.Name,
+ TakerId = result.TakerId,
+ TakerName = taker != null ? taker.Name : null,
+ PlaceId = result.PlaceId,
+ PlaceName = place.Name
+ };
+
+ IndexSortOptions.Add(s => s.Start, Raven.Abstractions.Indexing.SortOptions.String);
+ }
+ }
}
View
38 Raven.Tests/Bugs/LiveProjections/ParentAndChildrenNames.cs
@@ -1,20 +1,20 @@
-using System.Linq;
-using Raven.Client.Indexes;
-
-namespace Raven.Tests.Bugs.LiveProjections
-{
- public class ParentAndChildrenNames : AbstractIndexCreationTask<Person>
- {
- public ParentAndChildrenNames()
- {
- Map = people => from person in people
- where person.Children.Length > 0
- select new { person.Name };
- TransformResults = (database, people) =>
- from person in people
- let children = database.Load<Person>(person.Children)
- select new {person.Name, ChildrenNames = children.Select(x => x.Name)};
-
- }
- }
+using System.Linq;
+using Raven.Client.Indexes;
+