-
Notifications
You must be signed in to change notification settings - Fork 287
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
4af30fd
commit 066e180
Showing
19 changed files
with
200 additions
and
73 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
...Test/ServerTelemetryChannel.Test/TelemetryChannel.Tests/Helpers/StubTransmissionPolicy.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
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
6 changes: 2 additions & 4 deletions
6
...icationLifecycleTransmissionPolicyTest.cs → ...icationLifecycleTransmissionPolicyTest.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
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
58 changes: 58 additions & 0 deletions
58
...metryChannel.Tests/Implementation/TransmissionPolicy/TransmissionPolicyCollectionTests.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,58 @@ | ||
namespace Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.Implementation.TransmissionPolicy | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
[TestClass] | ||
[TestCategory("TransmissionPolicy")] | ||
public class TransmissionPolicyCollectionTests | ||
{ | ||
[TestMethod] | ||
public void VerifyCalcuateMinimums() | ||
{ | ||
// Setup | ||
var policies = new TransmissionPolicyCollection(policies: new List<TransmissionPolicy> | ||
{ | ||
new MockValueTransmissionPolicy(maxSenderCapacity: null, maxBufferCapacity: null, maxStorageCapacity: null), | ||
new MockValueTransmissionPolicy(maxSenderCapacity: 1, maxBufferCapacity: 2, maxStorageCapacity: 3), | ||
new MockValueTransmissionPolicy(maxSenderCapacity: 101, maxBufferCapacity: 102, maxStorageCapacity: 103), | ||
}); | ||
|
||
// Act & Verify | ||
Assert.AreEqual(1, policies.CalculateMinimumMaxSenderCapacity()); | ||
Assert.AreEqual(2, policies.CalculateMinimumMaxBufferCapacity()); | ||
Assert.AreEqual(3, policies.CalculateMinimumMaxStorageCapacity()); | ||
} | ||
|
||
|
||
[TestMethod] | ||
public void VerifyCalcuateMinimums_CanHandleNulls() | ||
{ | ||
// Setup | ||
var policies = new TransmissionPolicyCollection(policies: new List<TransmissionPolicy> | ||
{ | ||
new MockValueTransmissionPolicy(maxSenderCapacity: null, maxBufferCapacity: null, maxStorageCapacity: null), | ||
}); | ||
|
||
// Act & Verify | ||
Assert.AreEqual(null, policies.CalculateMinimumMaxSenderCapacity()); | ||
Assert.AreEqual(null, policies.CalculateMinimumMaxBufferCapacity()); | ||
Assert.AreEqual(null, policies.CalculateMinimumMaxStorageCapacity()); | ||
} | ||
|
||
private class MockValueTransmissionPolicy : TransmissionPolicy | ||
{ | ||
public MockValueTransmissionPolicy(int? maxSenderCapacity, int? maxBufferCapacity, int? maxStorageCapacity) | ||
{ | ||
this.MaxSenderCapacity = maxSenderCapacity; | ||
this.MaxBufferCapacity = maxBufferCapacity; | ||
this.MaxStorageCapacity = maxStorageCapacity; | ||
} | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
.../Implementation/TransmissionPolicyTest.cs → ...nsmissionPolicy/TransmissionPolicyTest.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
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
2 changes: 1 addition & 1 deletion
2
...ApplicationLifecycleTransmissionPolicy.cs → ...ApplicationLifecycleTransmissionPolicy.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
2 changes: 1 addition & 1 deletion
2
...tation/ErrorHandlingTransmissionPolicy.cs → ...Policy/ErrorHandlingTransmissionPolicy.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
2 changes: 1 addition & 1 deletion
2
.../NetworkAvailabilityTransmissionPolicy.cs → .../NetworkAvailabilityTransmissionPolicy.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
2 changes: 1 addition & 1 deletion
2
...ation/PartialSuccessTransmissionPolicy.cs → ...olicy/PartialSuccessTransmissionPolicy.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
2 changes: 1 addition & 1 deletion
2
...mentation/ThrottlingTransmissionPolicy.cs → ...ionPolicy/ThrottlingTransmissionPolicy.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
2 changes: 1 addition & 1 deletion
2
...nnel/Implementation/TransmissionPolicy.cs → .../TransmissionPolicy/TransmissionPolicy.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
Oops, something went wrong.