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

Commit abf53ef

Browse files
authored
Merge pull request #240 from agametov/master
fix 'if' statements with identical conditional expressions
2 parents bfbd58b + 46a5259 commit abf53ef

29 files changed

+92
-92
lines changed

src/ServiceStack.Redis/Generic/RedisTypedClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public IRedisSet TypeIdsSet
166166
public T this[string key]
167167
{
168168
get { return GetValue(key); }
169-
set { SetEntry(key, value); }
169+
set { SetValue(key, value); }
170170
}
171171

172172
public byte[] SerializeValue(T value)

src/ServiceStack.Redis/RedisClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public void Init()
9696
public string this[string key]
9797
{
9898
get { return GetValue(key); }
99-
set { SetEntry(key, value); }
99+
set { SetValue(key, value); }
100100
}
101101

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

678-
this.SetEntry(urnKey, valueString);
678+
this.SetValue(urnKey, valueString);
679679
RegisterTypeId(entity);
680680

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

693-
this.SetEntry(urnKey, valueString);
693+
this.SetValue(urnKey, valueString);
694694

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

src/ServiceStack.Redis/RedisNativeClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2182,7 +2182,7 @@ public long GeoAdd(string key, double longitude, double latitude, string member)
21822182
{
21832183
if (key == null)
21842184
throw new ArgumentNullException("key");
2185-
if (key == null)
2185+
if (member == null)
21862186
throw new ArgumentNullException("member");
21872187

21882188
return SendExpectLong(Commands.GeoAdd, key.ToUtf8Bytes(), longitude.ToUtf8Bytes(), latitude.ToUtf8Bytes(), member.ToUtf8Bytes());

tests/ServiceStack.Redis.Tests.Sentinel/Redis3SentinelSetupTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,17 @@ public void Can_connect_to_GoogleCloud_3SentinelSetup()
5858

5959
client.FlushAll();
6060

61-
client.SetEntry("Sentinel3Setup", "GoogleCloud");
61+
client.SetValue("Sentinel3Setup", "GoogleCloud");
6262

63-
var result = client.GetEntry("Sentinel3Setup");
63+
var result = client.GetValue("Sentinel3Setup");
6464
Assert.That(result, Is.EqualTo("GoogleCloud"));
6565
}
6666

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

71-
var result = readOnly.GetEntry("Sentinel3Setup");
71+
var result = readOnly.GetValue("Sentinel3Setup");
7272
Assert.That(result, Is.EqualTo("GoogleCloud"));
7373
}
7474
}

tests/ServiceStack.Redis.Tests.Sentinel/RedisResolverTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ namespace ServiceStack.Redis.Tests.Sentinel
99
public class RedisResolverTests
1010
: RedisSentinelTestBase
1111
{
12-
[TestFixtureSetUp]
13-
public void TestFixtureSetUp()
12+
[OneTimeSetUp]
13+
public void OneTimeSetUp()
1414
{
1515
StartAllRedisServers();
1616
}
1717

18-
[TestFixtureTearDown]
19-
public void TestFixtureTearDown()
18+
[OneTimeTearDown]
19+
public void OneTimeTearDown()
2020
{
2121
ShutdownAllRedisServers();
2222
}

tests/ServiceStack.Redis.Tests.Sentinel/RedisSentinelTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ namespace ServiceStack.Redis.Tests.Sentinel
1010
public class RedisSentinelTests
1111
: RedisSentinelTestBase
1212
{
13-
[TestFixtureSetUp]
13+
[OneTimeSetUp]
1414
public void OnBeforeTestFixture()
1515
{
1616
StartAllRedisServers();
1717
StartAllRedisSentinels();
1818
LogManager.LogFactory = new ConsoleLogFactory(debugEnabled:true);
1919
}
2020

21-
[TestFixtureTearDown]
21+
[OneTimeTearDown]
2222
public void OnAfterTestFixture()
2323
{
2424
ShutdownAllRedisSentinels();

tests/ServiceStack.Redis.Tests/ConfigTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ namespace ServiceStack.Redis.Tests
55
[TestFixture]
66
public class ConfigTests
77
{
8-
[TestFixtureSetUp]
9-
public void TestFixtureSetUp()
8+
[OneTimeSetUp]
9+
public void OneTimeSetUp()
1010
{
1111
RedisConfig.VerifyMasterConnections = false;
1212
}
1313

14-
[TestFixtureTearDown]
15-
public void TestFixtureTearDown()
14+
[OneTimeTearDown]
15+
public void OneTimeTearDown()
1616
{
1717
RedisConfig.VerifyMasterConnections = true;
1818
}

tests/ServiceStack.Redis.Tests/CultureInfoTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ public class CultureInfoTests
1010
{
1111
private CultureInfo previousCulture = CultureInfo.InvariantCulture;
1212

13-
[TestFixtureSetUp]
14-
public void TestFixtureSetUp()
13+
[OneTimeSetUp]
14+
public void OneTimeSetUp()
1515
{
1616
#if NETCORE
1717
previousCulture = CultureInfo.CurrentCulture;
@@ -23,8 +23,8 @@ public void TestFixtureSetUp()
2323
#endif
2424
}
2525

26-
[TestFixtureTearDown]
27-
public void TestFixtureTearDown()
26+
[OneTimeTearDown]
27+
public void OneTimeTearDown()
2828
{
2929
#if NETCORE
3030
CultureInfo.CurrentCulture = previousCulture;

tests/ServiceStack.Redis.Tests/Examples/SimplePubSub.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public class SimplePubSub
1313
const string MessagePrefix = "MESSAGE ";
1414
const int PublishMessageCount = 5;
1515

16-
[TestFixtureSetUp]
17-
public void TestFixtureSetUp()
16+
[OneTimeSetUp]
17+
public void OneTimeSetUp()
1818
{
1919
using (var redis = new RedisClient(TestConfig.SingleHost))
2020
{

tests/ServiceStack.Redis.Tests/Generic/RedisClientTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace ServiceStack.Redis.Tests.Generic
88
[TestFixture, Category("Integration")]
99
public class RedisClientTests : RedisClientTestsBase
1010
{
11-
[TestFixtureSetUp]
11+
[OneTimeSetUp]
1212
public void TestFixture()
1313
{
1414
}

tests/ServiceStack.Redis.Tests/Generic/RedisTypedPipelineTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void Can_call_single_operation_in_pipeline()
4040

4141
using (var pipeline = typedClient.CreatePipeline())
4242
{
43-
pipeline.QueueCommand(r => r.SetEntry(Key, model));
43+
pipeline.QueueCommand(r => r.SetValue(Key, model));
4444

4545
pipeline.Flush();
4646
}
@@ -55,7 +55,7 @@ public void No_commit_of_atomic_pipelines_discards_all_commands()
5555

5656
using (var pipeline = typedClient.CreatePipeline())
5757
{
58-
pipeline.QueueCommand(r => r.SetEntry(Key, model));
58+
pipeline.QueueCommand(r => r.SetValue(Key, model));
5959
}
6060

6161
Assert.That(typedClient.GetValue(Key), Is.Null);
@@ -69,7 +69,7 @@ public void Exception_in_atomic_pipelines_discards_all_commands()
6969
{
7070
using (var pipeline = typedClient.CreatePipeline())
7171
{
72-
pipeline.QueueCommand(r => r.SetEntry(Key, model));
72+
pipeline.QueueCommand(r => r.SetValue(Key, model));
7373
throw new NotSupportedException();
7474
}
7575
}

tests/ServiceStack.Redis.Tests/Generic/RedisTypedTransactionTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void Can_call_single_operation_in_transaction()
3939

4040
using (var trans = typedClient.CreateTransaction())
4141
{
42-
trans.QueueCommand(r => r.SetEntry(Key, model));
42+
trans.QueueCommand(r => r.SetValue(Key, model));
4343

4444
trans.Commit();
4545
}
@@ -54,7 +54,7 @@ public void No_commit_of_atomic_transactions_discards_all_commands()
5454

5555
using (var trans = typedClient.CreateTransaction())
5656
{
57-
trans.QueueCommand(r => r.SetEntry(Key, model));
57+
trans.QueueCommand(r => r.SetValue(Key, model));
5858
}
5959

6060
Assert.That(typedClient.GetValue(Key), Is.Null);
@@ -68,7 +68,7 @@ public void Exception_in_atomic_transactions_discards_all_commands()
6868
{
6969
using (var trans = typedClient.CreateTransaction())
7070
{
71-
trans.QueueCommand(r => r.SetEntry(Key, model));
71+
trans.QueueCommand(r => r.SetValue(Key, model));
7272
throw new NotSupportedException();
7373
}
7474
}

tests/ServiceStack.Redis.Tests/Integration/MultiThreadedRedisClientIntegrationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class MultiThreadedRedisClientIntegrationTests
1717
{
1818
private static string testData;
1919

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

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

102102
Log("\t{0} => {1} len {2} {3} len", testClientKey,

tests/ServiceStack.Redis.Tests/Integration/RedisRegressionTestRun.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class RedisRegressionTestRun
1414
{
1515
private static string testData;
1616

17-
[TestFixtureSetUp]
17+
[OneTimeSetUp]
1818
public void onBeforeTestFixture()
1919
{
2020
var results = 100.Times(x => ModelWithFieldsOfDifferentTypes.Create(x));

tests/ServiceStack.Redis.Tests/PooledRedisClientManagerTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ namespace ServiceStack.Redis.Tests
1414
[TestFixture, Category("Integration")]
1515
public class PooledRedisClientManagerTests
1616
{
17-
[TestFixtureSetUp]
18-
public void TestFixtureSetUp()
17+
[OneTimeSetUp]
18+
public void OneTimeSetUp()
1919
{
2020
RedisConfig.VerifyMasterConnections = false;
2121
}
2222

23-
[TestFixtureTearDown]
24-
public void TestFixtureTearDown()
23+
[OneTimeTearDown]
24+
public void OneTimeTearDown()
2525
{
2626
RedisConfig.VerifyMasterConnections = true;
2727
}
@@ -387,7 +387,7 @@ public void Does_throw_TimeoutException_when_PoolTimeout_exceeded()
387387
}
388388
catch (TimeoutException ex)
389389
{
390-
Assert.That(ex.Message, Is.StringStarting("Redis Timeout expired."));
390+
Assert.That(ex.Message, Does.StartWith("Redis Timeout expired."));
391391
}
392392

393393
var slaves = 4.Times(i => manager.GetReadOnlyClient());
@@ -399,7 +399,7 @@ public void Does_throw_TimeoutException_when_PoolTimeout_exceeded()
399399
}
400400
catch (TimeoutException ex)
401401
{
402-
Assert.That(ex.Message, Is.StringStarting("Redis Timeout expired."));
402+
Assert.That(ex.Message, Does.StartWith("Redis Timeout expired."));
403403
}
404404
}
405405
}

tests/ServiceStack.Redis.Tests/RedisClientEvalTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public void Does_flush_all_scripts()
125125
}
126126
catch (RedisResponseException ex)
127127
{
128-
Assert.That(ex.Message, Is.StringContaining("NOSCRIPT"));
128+
Assert.That(ex.Message, Does.Contain("NOSCRIPT"));
129129
}
130130
}
131131

0 commit comments

Comments
 (0)