-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an option of creating a service message writer that doesn't set…
… a top-level flowId attribute on messages
- Loading branch information
1 parent
c2db442
commit 71032ce
Showing
17 changed files
with
164 additions
and
81 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
49 changes: 49 additions & 0 deletions
49
TeamCity.ServiceMessages.Tests/Write/Specials/FlowAwareServiceMessageWriterTest.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,49 @@ | ||
namespace JetBrains.TeamCity.ServiceMessages.Tests.Write.Specials | ||
{ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Moq; | ||
using NUnit.Framework; | ||
using ServiceMessages.Write; | ||
using ServiceMessages.Write.Special; | ||
using ServiceMessages.Write.Special.Impl; | ||
|
||
[TestFixture] | ||
public class FlowAwareServiceMessageWriterTest | ||
{ | ||
[Test] | ||
public void ShouldNotAddFlowIdAttributeToServiceMessageWhenFlowIdIsNotSet() | ||
{ | ||
var processorMock = new Mock<IServiceMessageProcessor>(); | ||
var flowAwareWriter = new FlowAwareServiceMessageWriter( | ||
null, | ||
processorMock.Object, | ||
Mock.Of<IFlowIdGenerator>(), | ||
new List<IServiceMessageUpdater>()); | ||
|
||
var serviceMessage = new ServiceMessage("foo"); | ||
flowAwareWriter.AddServiceMessage(serviceMessage); | ||
|
||
processorMock.Verify(x => x.AddServiceMessage( | ||
It.Is<IServiceMessage>(m => m.Keys.All(k => k != "flowId")))); | ||
} | ||
|
||
[Test] | ||
public void ShouldAddFlowIdAttributeToServiceMessageWhenFlowIdIsSet() | ||
{ | ||
string flowId = "123"; | ||
var processorMock = new Mock<IServiceMessageProcessor>(); | ||
var flowAwareWriter = new FlowAwareServiceMessageWriter( | ||
flowId, | ||
processorMock.Object, | ||
Mock.Of<IFlowIdGenerator>(), | ||
new List<IServiceMessageUpdater>()); | ||
|
||
var serviceMessage = new ServiceMessage("foo"); | ||
flowAwareWriter.AddServiceMessage(serviceMessage); | ||
|
||
processorMock.Verify(x => x.AddServiceMessage( | ||
It.Is<IServiceMessage>(m => m.GetValue("flowId") == flowId))); | ||
} | ||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.