This repository has been archived by the owner on May 25, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Issue 54 - Specify timeout when default port is being used.
Also added unit tests.
- Loading branch information
Showing
3 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
test/FluentCassandra.Tests/Bugs/Issue65ServerTimeoutLost.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Xunit; | ||
using FluentCassandra.Connections; | ||
|
||
namespace FluentCassandra.Bugs | ||
{ | ||
public class Issue65ServerTimeoutLost | ||
{ | ||
[Fact] | ||
public void TestSingleServerWithHostAndPort() | ||
{ | ||
Assert.Equal(5, new ConnectionBuilder("Server=host:123;Connection Timeout=5").Servers[0].Timeout); | ||
} | ||
|
||
[Fact] | ||
public void TestSingleServerWithHostAndDefaultPort() | ||
{ | ||
Assert.Equal(5, new ConnectionBuilder("Server=host;Connection Timeout=5").Servers[0].Timeout); | ||
} | ||
|
||
[Fact] | ||
public void TestMultipleServersWithHostAndPort() | ||
{ | ||
var servers = new ConnectionBuilder("Server=host:123,host2:456,host3:789;Connection Timeout=5").Servers; | ||
Assert.Equal(3, servers.Count); | ||
foreach (var server in servers) | ||
{ | ||
Assert.Equal(5, server.Timeout); | ||
} | ||
} | ||
|
||
[Fact] | ||
public void TestMultipleServersWithHostAndDefaultPort() | ||
{ | ||
var servers = new ConnectionBuilder("Server=host,host2,host3;Connection Timeout=5").Servers; | ||
Assert.Equal(3, servers.Count); | ||
foreach (var server in servers) | ||
{ | ||
Assert.Equal(5, server.Timeout); | ||
} | ||
} | ||
|
||
[Fact] | ||
public void TestMultipleServersWithHostAndMixedPorts() | ||
{ | ||
var servers = new ConnectionBuilder("Server=host:123,host2,host3:789;Connection Timeout=5").Servers; | ||
Assert.Equal(3, servers.Count); | ||
foreach (var server in servers) | ||
{ | ||
Assert.Equal(5, server.Timeout); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters