Commit 265383b1 authored by Nick Craver's avatar Nick Craver

Cleanup: NRediSearch example usage

parent 09ca0fc4
...@@ -8,19 +8,21 @@ namespace NRediSearch.Test ...@@ -8,19 +8,21 @@ namespace NRediSearch.Test
{ {
public class ExampleUsage : IDisposable public class ExampleUsage : IDisposable
{ {
ConnectionMultiplexer conn; private ConnectionMultiplexer conn;
IDatabase db; private IDatabase db;
public ExampleUsage() public ExampleUsage()
{ {
conn = ConnectionMultiplexer.Connect("127.0.0.1:6379"); conn = ConnectionMultiplexer.Connect("127.0.0.1:6379");
db = conn.GetDatabase(); db = conn.GetDatabase();
} }
public void Dispose() public void Dispose()
{ {
conn?.Dispose(); conn?.Dispose();
conn = null; conn = null;
db = null; db = null;
} }
[Fact] [Fact]
public void BasicUsage() public void BasicUsage()
{ {
...@@ -33,7 +35,7 @@ public void BasicUsage() ...@@ -33,7 +35,7 @@ public void BasicUsage()
.AddTextField("title", 5.0) .AddTextField("title", 5.0)
.AddTextField("body", 1.0) .AddTextField("body", 1.0)
.AddNumericField("price"); .AddNumericField("price");
Assert.True(client.CreateIndex(sc, Client.IndexOptions.Default)); Assert.True(client.CreateIndex(sc, Client.IndexOptions.Default));
// note: using java API equivalent here; it would be nice to // note: using java API equivalent here; it would be nice to
...@@ -67,9 +69,6 @@ public void BasicUsage() ...@@ -67,9 +69,6 @@ public void BasicUsage()
Assert.Equal("hello world", (string)item["title"]); Assert.Equal("hello world", (string)item["title"]);
Assert.Equal("lorem ipsum", (string)item["body"]); Assert.Equal("lorem ipsum", (string)item["body"]);
Assert.Equal(1337, (int)item["price"]); Assert.Equal(1337, (int)item["price"]);
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment