PageRenderTime 41ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/Raven.Tests/Bugs/IndexDefinitionEquality.cs

https://github.com/barryhagan/ravendb
C# | 45 lines | 35 code | 5 blank | 5 comment | 0 complexity | 6499bb8b9a6d237050f1725e37a38fdc MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, BSD-3-Clause, CC-BY-SA-3.0
  1. //-----------------------------------------------------------------------
  2. // <copyright file="IndexDefinitionEquality.cs" company="Hibernating Rhinos LTD">
  3. // Copyright (c) Hibernating Rhinos LTD. All rights reserved.
  4. // </copyright>
  5. //-----------------------------------------------------------------------
  6. using System.Linq;
  7. using Raven.Abstractions.Indexing;
  8. using Raven.Tests.Common;
  9. using Xunit;
  10. using Raven.Client.Indexes;
  11. namespace Raven.Tests.Bugs
  12. {
  13. public class IndexDefinitionEquality : NoDisposalNeeded
  14. {
  15. [Fact]
  16. public void TransformResultsFactoredIntoEqualityCheck()
  17. {
  18. IndexDefinition definitionOne = new IndexDefinitionBuilder<Blog, Blog>
  19. {
  20. Map = docs => from doc in docs
  21. select new { doc.Property },
  22. TransformResults = (database, results) => from result in results
  23. select new
  24. {
  25. Property = result.Property
  26. }
  27. }.ToIndexDefinition(new Client.Document.DocumentConvention());
  28. IndexDefinition definitionTwo = new IndexDefinitionBuilder<Blog, Blog>
  29. {
  30. Map = docs => from doc in docs
  31. select new { doc.Property }
  32. }.ToIndexDefinition(new Client.Document.DocumentConvention());
  33. Assert.False(definitionOne.Equals(definitionTwo));
  34. }
  35. public class Blog
  36. {
  37. public string Property { get; set; }
  38. }
  39. }
  40. }