Skip to content
This repository has been archived by the owner on Dec 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #240 from agametov/master
Browse files Browse the repository at this point in the history
fix 'if' statements with identical conditional expressions
  • Loading branch information
mythz authored Sep 6, 2017
2 parents bfbd58b + 46a5259 commit abf53ef
Show file tree
Hide file tree
Showing 29 changed files with 92 additions and 92 deletions.
2 changes: 1 addition & 1 deletion src/ServiceStack.Redis/Generic/RedisTypedClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public IRedisSet TypeIdsSet
public T this[string key]
{
get { return GetValue(key); }
set { SetEntry(key, value); }
set { SetValue(key, value); }
}

public byte[] SerializeValue(T value)
Expand Down
6 changes: 3 additions & 3 deletions src/ServiceStack.Redis/RedisClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void Init()
public string this[string key]
{
get { return GetValue(key); }
set { SetEntry(key, value); }
set { SetValue(key, value); }
}

public override void OnConnected() { }
Expand Down Expand Up @@ -675,7 +675,7 @@ public T Store<T>(T entity)
var urnKey = UrnKey(entity);
var valueString = JsonSerializer.SerializeToString(entity);

this.SetEntry(urnKey, valueString);
this.SetValue(urnKey, valueString);
RegisterTypeId(entity);

return entity;
Expand All @@ -690,7 +690,7 @@ public object StoreObject(object entity)
var urnKey = UrnKey(entityType, id);
var valueString = JsonSerializer.SerializeToString(entity);

this.SetEntry(urnKey, valueString);
this.SetValue(urnKey, valueString);

RegisterTypeId(GetTypeIdsSetKey(entityType), id.ToString());

Expand Down
2 changes: 1 addition & 1 deletion src/ServiceStack.Redis/RedisNativeClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2182,7 +2182,7 @@ public long GeoAdd(string key, double longitude, double latitude, string member)
{
if (key == null)
throw new ArgumentNullException("key");
if (key == null)
if (member == null)
throw new ArgumentNullException("member");

return SendExpectLong(Commands.GeoAdd, key.ToUtf8Bytes(), longitude.ToUtf8Bytes(), latitude.ToUtf8Bytes(), member.ToUtf8Bytes());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ public void Can_connect_to_GoogleCloud_3SentinelSetup()

client.FlushAll();

client.SetEntry("Sentinel3Setup", "GoogleCloud");
client.SetValue("Sentinel3Setup", "GoogleCloud");

var result = client.GetEntry("Sentinel3Setup");
var result = client.GetValue("Sentinel3Setup");
Assert.That(result, Is.EqualTo("GoogleCloud"));
}

using (var readOnly = redisManager.GetReadOnlyClient())
{
"{0}:{1}".Print(readOnly.Host, readOnly.Port);

var result = readOnly.GetEntry("Sentinel3Setup");
var result = readOnly.GetValue("Sentinel3Setup");
Assert.That(result, Is.EqualTo("GoogleCloud"));
}
}
Expand Down
8 changes: 4 additions & 4 deletions tests/ServiceStack.Redis.Tests.Sentinel/RedisResolverTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ namespace ServiceStack.Redis.Tests.Sentinel
public class RedisResolverTests
: RedisSentinelTestBase
{
[TestFixtureSetUp]
public void TestFixtureSetUp()
[OneTimeSetUp]
public void OneTimeSetUp()
{
StartAllRedisServers();
}

[TestFixtureTearDown]
public void TestFixtureTearDown()
[OneTimeTearDown]
public void OneTimeTearDown()
{
ShutdownAllRedisServers();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/ServiceStack.Redis.Tests.Sentinel/RedisSentinelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ namespace ServiceStack.Redis.Tests.Sentinel
public class RedisSentinelTests
: RedisSentinelTestBase
{
[TestFixtureSetUp]
[OneTimeSetUp]
public void OnBeforeTestFixture()
{
StartAllRedisServers();
StartAllRedisSentinels();
LogManager.LogFactory = new ConsoleLogFactory(debugEnabled:true);
}

[TestFixtureTearDown]
[OneTimeTearDown]
public void OnAfterTestFixture()
{
ShutdownAllRedisSentinels();
Expand Down
8 changes: 4 additions & 4 deletions tests/ServiceStack.Redis.Tests/ConfigTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ namespace ServiceStack.Redis.Tests
[TestFixture]
public class ConfigTests
{
[TestFixtureSetUp]
public void TestFixtureSetUp()
[OneTimeSetUp]
public void OneTimeSetUp()
{
RedisConfig.VerifyMasterConnections = false;
}

[TestFixtureTearDown]
public void TestFixtureTearDown()
[OneTimeTearDown]
public void OneTimeTearDown()
{
RedisConfig.VerifyMasterConnections = true;
}
Expand Down
8 changes: 4 additions & 4 deletions tests/ServiceStack.Redis.Tests/CultureInfoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public class CultureInfoTests
{
private CultureInfo previousCulture = CultureInfo.InvariantCulture;

[TestFixtureSetUp]
public void TestFixtureSetUp()
[OneTimeSetUp]
public void OneTimeSetUp()
{
#if NETCORE
previousCulture = CultureInfo.CurrentCulture;
Expand All @@ -23,8 +23,8 @@ public void TestFixtureSetUp()
#endif
}

[TestFixtureTearDown]
public void TestFixtureTearDown()
[OneTimeTearDown]
public void OneTimeTearDown()
{
#if NETCORE
CultureInfo.CurrentCulture = previousCulture;
Expand Down
4 changes: 2 additions & 2 deletions tests/ServiceStack.Redis.Tests/Examples/SimplePubSub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public class SimplePubSub
const string MessagePrefix = "MESSAGE ";
const int PublishMessageCount = 5;

[TestFixtureSetUp]
public void TestFixtureSetUp()
[OneTimeSetUp]
public void OneTimeSetUp()
{
using (var redis = new RedisClient(TestConfig.SingleHost))
{
Expand Down
2 changes: 1 addition & 1 deletion tests/ServiceStack.Redis.Tests/Generic/RedisClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace ServiceStack.Redis.Tests.Generic
[TestFixture, Category("Integration")]
public class RedisClientTests : RedisClientTestsBase
{
[TestFixtureSetUp]
[OneTimeSetUp]
public void TestFixture()
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void Can_call_single_operation_in_pipeline()

using (var pipeline = typedClient.CreatePipeline())
{
pipeline.QueueCommand(r => r.SetEntry(Key, model));
pipeline.QueueCommand(r => r.SetValue(Key, model));

pipeline.Flush();
}
Expand All @@ -55,7 +55,7 @@ public void No_commit_of_atomic_pipelines_discards_all_commands()

using (var pipeline = typedClient.CreatePipeline())
{
pipeline.QueueCommand(r => r.SetEntry(Key, model));
pipeline.QueueCommand(r => r.SetValue(Key, model));
}

Assert.That(typedClient.GetValue(Key), Is.Null);
Expand All @@ -69,7 +69,7 @@ public void Exception_in_atomic_pipelines_discards_all_commands()
{
using (var pipeline = typedClient.CreatePipeline())
{
pipeline.QueueCommand(r => r.SetEntry(Key, model));
pipeline.QueueCommand(r => r.SetValue(Key, model));
throw new NotSupportedException();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void Can_call_single_operation_in_transaction()

using (var trans = typedClient.CreateTransaction())
{
trans.QueueCommand(r => r.SetEntry(Key, model));
trans.QueueCommand(r => r.SetValue(Key, model));

trans.Commit();
}
Expand All @@ -54,7 +54,7 @@ public void No_commit_of_atomic_transactions_discards_all_commands()

using (var trans = typedClient.CreateTransaction())
{
trans.QueueCommand(r => r.SetEntry(Key, model));
trans.QueueCommand(r => r.SetValue(Key, model));
}

Assert.That(typedClient.GetValue(Key), Is.Null);
Expand All @@ -68,7 +68,7 @@ public void Exception_in_atomic_transactions_discards_all_commands()
{
using (var trans = typedClient.CreateTransaction())
{
trans.QueueCommand(r => r.SetEntry(Key, model));
trans.QueueCommand(r => r.SetValue(Key, model));
throw new NotSupportedException();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class MultiThreadedRedisClientIntegrationTests
{
private static string testData;

[TestFixtureSetUp]
[OneTimeSetUp]
public void onBeforeTestFixture()
{
var results = 100.Times(x => ModelWithFieldsOfDifferentTypes.Create(x));
Expand Down Expand Up @@ -96,7 +96,7 @@ private static void UseClient(RedisClient client, int clientNo)
Log("Client '{0}' is using '{1}'", clientNo, client.Host);

var testClientKey = "test:" + host + ":" + clientNo;
client.SetEntry(testClientKey, testData);
client.SetValue(testClientKey, testData);
var result = client.GetValue(testClientKey) ?? "";

Log("\t{0} => {1} len {2} {3} len", testClientKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class RedisRegressionTestRun
{
private static string testData;

[TestFixtureSetUp]
[OneTimeSetUp]
public void onBeforeTestFixture()
{
var results = 100.Times(x => ModelWithFieldsOfDifferentTypes.Create(x));
Expand Down
12 changes: 6 additions & 6 deletions tests/ServiceStack.Redis.Tests/PooledRedisClientManagerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ namespace ServiceStack.Redis.Tests
[TestFixture, Category("Integration")]
public class PooledRedisClientManagerTests
{
[TestFixtureSetUp]
public void TestFixtureSetUp()
[OneTimeSetUp]
public void OneTimeSetUp()
{
RedisConfig.VerifyMasterConnections = false;
}

[TestFixtureTearDown]
public void TestFixtureTearDown()
[OneTimeTearDown]
public void OneTimeTearDown()
{
RedisConfig.VerifyMasterConnections = true;
}
Expand Down Expand Up @@ -387,7 +387,7 @@ public void Does_throw_TimeoutException_when_PoolTimeout_exceeded()
}
catch (TimeoutException ex)
{
Assert.That(ex.Message, Is.StringStarting("Redis Timeout expired."));
Assert.That(ex.Message, Does.StartWith("Redis Timeout expired."));
}

var slaves = 4.Times(i => manager.GetReadOnlyClient());
Expand All @@ -399,7 +399,7 @@ public void Does_throw_TimeoutException_when_PoolTimeout_exceeded()
}
catch (TimeoutException ex)
{
Assert.That(ex.Message, Is.StringStarting("Redis Timeout expired."));
Assert.That(ex.Message, Does.StartWith("Redis Timeout expired."));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ServiceStack.Redis.Tests/RedisClientEvalTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void Does_flush_all_scripts()
}
catch (RedisResponseException ex)
{
Assert.That(ex.Message, Is.StringContaining("NOSCRIPT"));
Assert.That(ex.Message, Does.Contain("NOSCRIPT"));
}
}

Expand Down
Loading

0 comments on commit abf53ef

Please sign in to comment.