-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c3c5afc
commit 78e78cd
Showing
2 changed files
with
71 additions
and
4 deletions.
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
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,65 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using RabbitMQ.Stream.Client; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
using Xunit.Sdk; | ||
|
||
namespace Tests | ||
{ | ||
|
||
|
||
[Collection("Sequential")] | ||
public class StreamSpecTests | ||
{ | ||
private readonly ITestOutputHelper testOutputHelper; | ||
|
||
public StreamSpecTests(ITestOutputHelper testOutputHelper) | ||
{ | ||
this.testOutputHelper = testOutputHelper; | ||
} | ||
|
||
|
||
[Fact] | ||
[WaitTestBeforeAfter] | ||
public void DefaultStreamSpecMustHaveAtLeastQueueLeaderLocator() | ||
{ | ||
StreamSpec actualSpec = new StreamSpec("theStreamName"); | ||
StreamSpec expectedSpec = new StreamSpec("theStreamName") { | ||
LeaderLocator = LeaderLocator.LeastLeaders | ||
}; | ||
Assert.Equal(expectedSpec.Args, actualSpec.Args); | ||
|
||
} | ||
|
||
|
||
[Fact] | ||
[WaitTestBeforeAfter] | ||
public void CanOverrideAnyStreamSpecAttributes() | ||
{ | ||
StreamSpec spec = new StreamSpec("theStreamName"); | ||
spec.MaxAge = TimeSpan.FromHours(3); | ||
spec.MaxLengthBytes = 10000; | ||
spec.LeaderLocator = LeaderLocator.Random; // this is an override because the spec has already a default value | ||
|
||
// can override any settings being set | ||
spec.MaxAge = TimeSpan.FromHours(5); | ||
spec.MaxLengthBytes = 20000; | ||
|
||
|
||
StreamSpec expectedSpec = new StreamSpec("theStreamName") { | ||
LeaderLocator = LeaderLocator.Random, | ||
MaxLengthBytes = 20000, | ||
MaxAge = TimeSpan.FromHours(5) | ||
}; | ||
Assert.Equal(expectedSpec.Args, spec.Args); | ||
} | ||
|
||
} | ||
} |