Permalink
Browse files

Clean code

  • Loading branch information...
1 parent be2f7b2 commit 70a1dc0d76f5ce74265a8d5681a5d231640aa3db @fitzchak fitzchak committed Apr 3, 2012
@@ -57,17 +57,13 @@ public Expiration()
documentStore.Initialize();
}
- #region IDisposable Members
-
public void Dispose()
{
documentStore.Dispose();
ravenDbServer.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");
}
}
-}
+}
@@ -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,17 +113,13 @@ private void CreateRdbmsSchema()
}
}
- #region IDisposable Members
-
public void Dispose()
{
documentStore.Dispose();
ravenDbServer.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;
}
}
-
-}
+}
@@ -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,17 +66,13 @@ private static string GetLorem(int numWords)
#endregion
- #region IDisposable Members
-
public void Dispose()
{
documentStore.Dispose();
ravenDbServer.Dispose();
database::Raven.Database.Extensions.IOExtensions.DeleteDirectory(path);
}
- #endregion
-
#region Test Facts
[Fact]
@@ -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>
@@ -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>
@@ -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)
@@ -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;
@@ -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();
@@ -44,15 +44,10 @@ public RavenDbServer(RavenConfiguration settings)
}
}
- #region IDisposable Members
-
public void Dispose()
{
server.Dispose();
database.Dispose();
}
-
- #endregion
-
}
-}
+}
@@ -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);
@@ -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
@@ -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()
}
}
}
-
-
}
}
@@ -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");
@@ -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()
}
}
}
-
-
-
}
}
-}
+}
@@ -20,16 +20,12 @@ public MultiDicInSingleFile()
OpenDictionary();
}
- #region IDisposable Members
-
public void Dispose()
{
persistentSource.Dispose();
persistentSource.Delete();
}
- #endregion
-
protected void Commit()
{
Database.Commit();
Oops, something went wrong.

0 comments on commit 70a1dc0

Please sign in to comment.