Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clean code

  • Loading branch information...
commit 70a1dc0d76f5ce74265a8d5681a5d231640aa3db 1 parent be2f7b2
@fitzchak fitzchak authored
View
6 Bundles/Raven.Bundles.Tests/Expiration/Expiration.cs
@@ -57,8 +57,6 @@ public Expiration()
documentStore.Initialize();
}
- #region IDisposable Members
-
public void Dispose()
{
documentStore.Dispose();
@@ -66,8 +64,6 @@ public void Dispose()
database::Raven.Database.Extensions.IOExtensions.DeleteDirectory(path);
}
- #endregion
-
[Fact]
public void Can_add_entity_with_expiry_then_read_it_before_it_expires()
{
@@ -154,4 +150,4 @@ public void After_expiry_passed_document_will_be_physically_deleted()
Assert.False(true, "Document was not deleted");
}
}
-}
+}
View
9 Bundles/Raven.Bundles.Tests/IndexReplication/ReplicateToSql.cs
@@ -9,6 +9,7 @@
using System.Configuration;
using System.Data.Common;
using System.IO;
+using System.Linq;
using System.Reflection;
using System.Xml;
using Raven.Abstractions.Indexing;
@@ -18,7 +19,6 @@
using Raven.Client.Document;
using Raven.Server;
using Xunit;
-using System.Linq;
using Xunit.Sdk;
namespace Raven.Bundles.Tests.IndexReplication
@@ -113,8 +113,6 @@ private void CreateRdbmsSchema()
}
}
- #region IDisposable Members
-
public void Dispose()
{
documentStore.Dispose();
@@ -122,8 +120,6 @@ public void Dispose()
database::Raven.Database.Extensions.IOExtensions.DeleteDirectory(path);
}
- #endregion
-
[FactIfSqlServerIsAvailable]
public void Can_replicate_to_sql()
{
@@ -403,5 +399,4 @@ private static string GetAppropriateConnectionStringNameInternal()
return null;
}
}
-
-}
+}
View
13 Bundles/Raven.Bundles.Tests/MoreLikeThis/MoreLikeThisTests.cs
@@ -1,22 +1,19 @@
extern alias database;
using System;
using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.Diagnostics;
+using System.ComponentModel.Composition.Hosting;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
-using System.Text;
-using System.Threading;
+using System.Text;
using Lucene.Net.Analysis;
using Lucene.Net.Analysis.Standard;
using Raven.Abstractions.Indexing;
using Raven.Bundles.MoreLikeThis;
using Raven.Client.Document;
using Raven.Client.Indexes;
-using Raven.Client.MoreLikeThis;
-using Raven.Json.Linq;
+using Raven.Client.MoreLikeThis;
using Raven.Server;
using Xunit;
using MoreLikeThisQueryParameters = Raven.Client.MoreLikeThis.MoreLikeThisQueryParameters;
@@ -69,8 +66,6 @@ private static string GetLorem(int numWords)
#endregion
- #region IDisposable Members
-
public void Dispose()
{
documentStore.Dispose();
@@ -78,8 +73,6 @@ public void Dispose()
database::Raven.Database.Extensions.IOExtensions.DeleteDirectory(path);
}
- #endregion
-
#region Test Facts
[Fact]
View
4 Raven.Client.Lightweight/Document/DocumentStore.cs
@@ -228,8 +228,6 @@ protected virtual RavenConnectionStringOptions GetConnectionStringOptions()
/// <value>The default database name.</value>
public string DefaultDatabase { get; set; }
- #region IDisposable Members
-
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
@@ -258,8 +256,6 @@ public override void Dispose()
Console.WriteLine(stacktraceDebug);
}
- #endregion
-
#if !SILVERLIGHT
/// <summary>
View
5 Raven.Client.Lightweight/Shard/ShardedDocumentStore.cs
@@ -80,8 +80,6 @@ public override Document.DocumentConvention Conventions
/// <value>The identifier.</value>
public override string Identifier { get; set; }
- #region IDisposable Members
-
/// <summary>
/// Called after dispose is completed
/// </summary>
@@ -101,9 +99,6 @@ public override void Dispose()
afterDispose(this, EventArgs.Empty);
}
- #endregion
-
-
#if !NET_3_5
/// <summary>
View
4 Raven.Database/Indexing/Index.cs
@@ -82,7 +82,7 @@ protected Index(Directory directory, string name, IndexDefinition indexDefinitio
/// </summary>
public abstract bool IsMapReduce { get; }
- #region IDisposable Members
+
public void Dispose()
{
@@ -133,8 +133,6 @@ public void Dispose()
}
}
- #endregion
-
public void Flush(bool optimize)
{
lock (writeLock)
View
4 Raven.Database/Indexing/IndexStorage.cs
@@ -236,8 +236,6 @@ public bool HasIndex(string index)
return indexes.ContainsKey(index);
}
- #region IDisposable Members
-
public void Dispose()
{
foreach (var index in indexes.Values)
@@ -249,8 +247,6 @@ public void Dispose()
crashMarker.Dispose();
}
- #endregion
-
public void DeleteIndex(string name)
{
Index value;
View
4 Raven.Database/Server/HttpServer.cs
@@ -145,7 +145,7 @@ private void TenantDatabaseRemoved(object sender, TenantDatabaseModified.Event @
CleanupDatabase(@event.Name);
}
- #region IDisposable Members
+
public void Dispose()
{
@@ -191,8 +191,6 @@ public void Dispose()
}
}
- #endregion
-
public void StartListening()
{
listener = new HttpListener();
View
7 Raven.Server/RavenDbServer.cs
@@ -44,15 +44,10 @@ public RavenDbServer(RavenConfiguration settings)
}
}
- #region IDisposable Members
-
public void Dispose()
{
server.Dispose();
database.Dispose();
}
-
- #endregion
-
}
-}
+}
View
4 Raven.Storage.Esent/StorageActions/General.cs
@@ -75,7 +75,7 @@ public Session Session
}
}
- #region IDisposable Members
+
[DebuggerHidden, DebuggerNonUserCode, DebuggerStepThrough]
public void Dispose()
@@ -124,8 +124,6 @@ public void Dispose()
}
- #endregion
-
public void Commit(CommitTransactionGrbit txMode)
{
transaction.Commit(txMode);
View
4 Raven.Storage.Esent/TransactionalStorage.cs
@@ -102,7 +102,7 @@ public string Database
public Guid Id { get; private set; }
- #region IDisposable Members
+
public void Dispose()
{
@@ -167,8 +167,6 @@ public bool HandleException(Exception exception)
return e.Error == JET_err.InvalidInstance;
}
- #endregion
-
public bool Initialize(IUuidGenerator uuidGenerator)
{
try
View
6 Raven.Tests/Bugs/AttachmentEndoding.cs
@@ -26,15 +26,11 @@ public AttachmentEndoding()
NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8079);
}
- #region IDisposable Members
-
public void Dispose()
{
IOExtensions.DeleteDirectory(path);
}
- #endregion
-
[Fact]
public void Can_get_proper_attachment_names()
{
@@ -56,7 +52,5 @@ public void Can_get_proper_attachment_names()
}
}
}
-
-
}
}
View
12 Raven.Tests/Bugs/WillNotFailSystemIfServerIsNotAvailableOnStartup.cs
@@ -4,33 +4,23 @@
// </copyright>
//-----------------------------------------------------------------------
using System;
-using System.IO;
using System.Net;
-using System.Reflection;
-using System.Web.Management;
using Raven.Client.Document;
-using Raven.Database.Config;
using Raven.Database.Extensions;
using Raven.Database.Server;
-using Raven.Tests.Document;
using Xunit;
namespace Raven.Tests.Bugs
{
public class WillNotFailSystemIfServerIsNotAvailableOnStartup : RemoteClientTest, IDisposable
{
- private string path;
-
- #region IDisposable Members
+ private readonly string path;
public void Dispose()
{
IOExtensions.DeleteDirectory(path);
}
- #endregion
-
-
public WillNotFailSystemIfServerIsNotAvailableOnStartup()
{
path = GetPath("TestDb");
View
17 Raven.Tests/Document/TotalCountServerTest.cs
@@ -24,27 +24,21 @@ public TotalCountServerTest()
NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8079);
}
- #region IDisposable Members
-
public void Dispose()
{
IOExtensions.DeleteDirectory(path);
}
- #endregion
-
[Fact]
public void TotalResultIsIncludedInQueryResult()
{
using (var server = GetNewServer(port, path))
{
- using (var store = new DocumentStore { Url = "http://localhost:" + port })
+ using (var store = new DocumentStore { Url = "http://localhost:" + port }.Initialize())
{
- store.Initialize();
-
using (var session = store.OpenSession())
{
- Company company1 = new Company()
+ var company1 = new Company()
{
Name = "Company1",
Address1 = "",
@@ -53,7 +47,7 @@ public void TotalResultIsIncludedInQueryResult()
Contacts = new List<Contact>(),
Phone = 2
};
- Company company2 = new Company()
+ var company2 = new Company()
{
Name = "Company2",
Address1 = "",
@@ -75,9 +69,6 @@ public void TotalResultIsIncludedInQueryResult()
}
}
}
-
-
-
}
}
-}
+}
View
4 Raven.Tests/Munin/MultiDicInSingleFile.cs
@@ -20,16 +20,12 @@ public MultiDicInSingleFile()
OpenDictionary();
}
- #region IDisposable Members
-
public void Dispose()
{
persistentSource.Dispose();
persistentSource.Delete();
}
- #endregion
-
protected void Commit()
{
Database.Commit();
View
141 Raven.Tests/Munin/MyToDoList.cs
@@ -1,75 +1,74 @@
using System;
-using System.Linq;
+using System.Linq;
using System.Text;
-using Xunit;
-
-namespace Raven.Munin.Tests
-{
- public class MyToDoList
- {
- [Fact]
- public void CanStoreToDoItems()
- {
- var repository = new ToDoRepository(new MemoryPersistentSource());
-
- repository.Save(new ToDo
- {
- Date = DateTime.Today.AddDays(2),
- Action = "Buy Milk"
- });
- }
-
- [Fact]
- public void CanReadToDoItems()
- {
- var repository = new ToDoRepository(new MemoryPersistentSource());
-
- var guid = repository.Save(new ToDo
- {
- Date = DateTime.Today.AddDays(2),
- Action = "Buy Milk"
- });
-
- var todo = repository.Get(guid);
- Assert.Equal("Buy Milk", todo.Action);
- }
-
- [Fact]
- public void CanIterate()
- {
- var repository = new ToDoRepository(new MemoryPersistentSource());
-
- for (int i = 0; i < 10; i++)
- {
- repository.Save(new ToDo
- {
- Date = DateTime.Today.AddDays(2),
- Action = "Buy Milk #" + i
- });
-
- }
- Assert.Equal(10, repository.All().Count());
- }
-
- [Fact]
- public void CanQuery()
- {
- var repository = new ToDoRepository(new MemoryPersistentSource());
-
- for (int i = 0; i < 10; i++)
- {
- repository.Save(new ToDo
- {
- Date = DateTime.Today.AddDays(2),
- Action = "Buy Milk #" + i
- });
-
- }
- var results = repository.All().OrderByDescending(toDo=>toDo.Action).Take(3).ToArray();
- Assert.Equal("Buy Milk #9", results[0].Action);
- Assert.Equal("Buy Milk #8", results[1].Action);
- Assert.Equal("Buy Milk #7", results[2].Action);
-
- }
+using Xunit;
+
+namespace Raven.Munin.Tests
+{
+ public class MyToDoList
+ {
+ [Fact]
+ public void CanStoreToDoItems()
+ {
+ var repository = new ToDoRepository(new MemoryPersistentSource());
+
+ repository.Save(new ToDo
+ {
+ Date = DateTime.Today.AddDays(2),
+ Action = "Buy Milk"
+ });
+ }
+
+ [Fact]
+ public void CanReadToDoItems()
+ {
+ var repository = new ToDoRepository(new MemoryPersistentSource());
+
+ var guid = repository.Save(new ToDo
+ {
+ Date = DateTime.Today.AddDays(2),
+ Action = "Buy Milk"
+ });
+
+ var todo = repository.Get(guid);
+ Assert.Equal("Buy Milk", todo.Action);
+ }
+
+ [Fact]
+ public void CanIterate()
+ {
+ var repository = new ToDoRepository(new MemoryPersistentSource());
+
+ for (int i = 0; i < 10; i++)
+ {
+ repository.Save(new ToDo
+ {
+ Date = DateTime.Today.AddDays(2),
+ Action = "Buy Milk #" + i
+ });
+
+ }
+ Assert.Equal(10, repository.All().Count());
+ }
+
+ [Fact]
+ public void CanQuery()
+ {
+ var repository = new ToDoRepository(new MemoryPersistentSource());
+
+ for (int i = 0; i < 10; i++)
+ {
+ repository.Save(new ToDo
+ {
+ Date = DateTime.Today.AddDays(2),
+ Action = "Buy Milk #" + i
+ });
+
+ }
+ var results = repository.All().OrderByDescending(toDo=>toDo.Action).Take(3).ToArray();
+ Assert.Equal("Buy Milk #9", results[0].Action);
+ Assert.Equal("Buy Milk #8", results[1].Action);
+ Assert.Equal("Buy Milk #7", results[2].Action);
+ }
}
}
View
1  Raven.Tests/Munin/Optimize.cs
@@ -3,7 +3,6 @@
// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
-
using Raven.Json.Linq;
using Xunit;
View
5 Raven.Tests/Spatial/SpatialIndexTest.cs
@@ -8,7 +8,6 @@
using Raven.Abstractions.Data;
using Raven.Abstractions.Extensions;
using Raven.Abstractions.Indexing;
-using Raven.Client.Document;
using Raven.Json.Linq;
using Raven.Database;
using Raven.Database.Config;
@@ -30,16 +29,12 @@ public SpatialIndexTest()
db.SpinBackgroundWorkers();
}
- #region IDisposable Members
-
public override void Dispose()
{
db.Dispose();
base.Dispose();
}
- #endregion
-
// same test as in Spatial.Net test cartisian
[Fact]
public void CanPerformSpatialSearch()
View
4 Raven.Tests/Triggers/Bugs/ModifyingMetadataFromTrigger.cs
@@ -22,15 +22,11 @@ public ModifyingMetadataFromTrigger()
NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8079);
}
- #region IDisposable Members
-
public void Dispose()
{
IOExtensions.DeleteDirectory(path);
}
- #endregion
-
[Fact]
public void WillNotCorruptData()
{
Please sign in to comment.
Something went wrong with that request. Please try again.