Updated to .NET 10
All checks were successful
Branch Build / build-test-deploy (push) Successful in 53s
All checks were successful
Branch Build / build-test-deploy (push) Successful in 53s
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using AMWD.Net.Api.Fritz.CallMonitor;
|
||||
|
||||
namespace FritzCallMonitor.Tests
|
||||
{
|
||||
@@ -8,12 +7,12 @@ namespace FritzCallMonitor.Tests
|
||||
{
|
||||
private string _dateOffset;
|
||||
|
||||
private readonly DateTime NOW = new(2025, 8, 25, 20, 15, 30, DateTimeKind.Local);
|
||||
private readonly DateTime _now = new(2025, 8, 25, 20, 15, 30, DateTimeKind.Local);
|
||||
|
||||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
var offset = TimeZoneInfo.Local.GetUtcOffset(NOW);
|
||||
var offset = TimeZoneInfo.Local.GetUtcOffset(_now);
|
||||
_dateOffset = offset < TimeSpan.Zero
|
||||
? "-" + offset.ToString("hh\\:mm")
|
||||
: "+" + offset.ToString("hh\\:mm");
|
||||
@@ -23,7 +22,7 @@ namespace FritzCallMonitor.Tests
|
||||
public void ShouldParseRingEvent()
|
||||
{
|
||||
// Arrange
|
||||
string line = $"{NOW:dd.MM.yy HH:mm:ss};RING;2;012345678901;9876543;SIP0;";
|
||||
string line = $"{_now:dd.MM.yy HH:mm:ss};RING;2;012345678901;9876543;SIP0;";
|
||||
var result = CallMonitorEventArgs.Parse(line);
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
@@ -39,7 +38,7 @@ namespace FritzCallMonitor.Tests
|
||||
[TestMethod]
|
||||
public void ShouldParseConnectEvent()
|
||||
{
|
||||
string line = $"{NOW:dd.MM.yy HH:mm:ss};CONNECT;1;3;012345678901;";
|
||||
string line = $"{_now:dd.MM.yy HH:mm:ss};CONNECT;1;3;012345678901;";
|
||||
var result = CallMonitorEventArgs.Parse(line);
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
@@ -55,7 +54,7 @@ namespace FritzCallMonitor.Tests
|
||||
[TestMethod]
|
||||
public void ShouldParseDisconnectEvent()
|
||||
{
|
||||
string line = $"{NOW:dd.MM.yy HH:mm:ss};DISCONNECT;2;42;";
|
||||
string line = $"{_now:dd.MM.yy HH:mm:ss};DISCONNECT;2;42;";
|
||||
var result = CallMonitorEventArgs.Parse(line);
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
@@ -71,7 +70,7 @@ namespace FritzCallMonitor.Tests
|
||||
[TestMethod]
|
||||
public void ShouldParseCallEvent()
|
||||
{
|
||||
string line = $"{NOW:dd.MM.yy HH:mm:ss};CALL;4;7;9876543;012345678901;SIP0;";
|
||||
string line = $"{_now:dd.MM.yy HH:mm:ss};CALL;4;7;9876543;012345678901;SIP0;";
|
||||
var result = CallMonitorEventArgs.Parse(line);
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
@@ -95,7 +94,7 @@ namespace FritzCallMonitor.Tests
|
||||
[TestMethod]
|
||||
public void ShouldReturnNullOnUnknownEventType()
|
||||
{
|
||||
string line = $"{NOW:dd.MM.yy HH:mm:ss};UNKNOWN;2;012345678901;9876543;SIP0;";
|
||||
string line = $"{_now:dd.MM.yy HH:mm:ss};UNKNOWN;2;012345678901;9876543;SIP0;";
|
||||
var result = CallMonitorEventArgs.Parse(line);
|
||||
Assert.IsNull(result);
|
||||
}
|
||||
@@ -103,7 +102,7 @@ namespace FritzCallMonitor.Tests
|
||||
[TestMethod]
|
||||
public void ShouldReturnNullOnInvalidConnectionId()
|
||||
{
|
||||
string line = $"{NOW:dd.MM.yy HH:mm:ss};RING;abc;012345678901;9876543;SIP0;";
|
||||
string line = $"{_now:dd.MM.yy HH:mm:ss};RING;abc;012345678901;9876543;SIP0;";
|
||||
var result = CallMonitorEventArgs.Parse(line);
|
||||
Assert.IsNull(result);
|
||||
}
|
||||
@@ -111,7 +110,7 @@ namespace FritzCallMonitor.Tests
|
||||
[TestMethod]
|
||||
public void ShouldHandleInvalidLinePortInConnect()
|
||||
{
|
||||
string line = $"{NOW:dd.MM.yy HH:mm:ss};CONNECT;1;abc;012345678901;";
|
||||
string line = $"{_now:dd.MM.yy HH:mm:ss};CONNECT;1;abc;012345678901;";
|
||||
var result = CallMonitorEventArgs.Parse(line);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsNull(result.LinePort);
|
||||
@@ -120,7 +119,7 @@ namespace FritzCallMonitor.Tests
|
||||
[TestMethod]
|
||||
public void ShouldHandleInvalidLinePortInCall()
|
||||
{
|
||||
string line = $"{NOW:dd.MM.yy HH:mm:ss};CALL;4;abc;9876543;012345678901;SIP0;";
|
||||
string line = $"{_now:dd.MM.yy HH:mm:ss};CALL;4;abc;9876543;012345678901;SIP0;";
|
||||
var result = CallMonitorEventArgs.Parse(line);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsNull(result.LinePort);
|
||||
@@ -129,7 +128,7 @@ namespace FritzCallMonitor.Tests
|
||||
[TestMethod]
|
||||
public void ShouldHandleInvalidDurationInDisconnect()
|
||||
{
|
||||
string line = $"{NOW:dd.MM.yy HH:mm:ss};DISCONNECT;2;abc;";
|
||||
string line = $"{_now:dd.MM.yy HH:mm:ss};DISCONNECT;2;abc;";
|
||||
var result = CallMonitorEventArgs.Parse(line);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsNull(result.Duration);
|
||||
@@ -138,7 +137,7 @@ namespace FritzCallMonitor.Tests
|
||||
[TestMethod]
|
||||
public void ShouldReturnNullOnTooFewColumns()
|
||||
{
|
||||
string line = $"{NOW:dd.MM.yy HH:mm:ss};RING;";
|
||||
string line = $"{_now:dd.MM.yy HH:mm:ss};RING;";
|
||||
var result = CallMonitorEventArgs.Parse(line);
|
||||
Assert.IsNull(result);
|
||||
}
|
||||
@@ -146,7 +145,7 @@ namespace FritzCallMonitor.Tests
|
||||
[TestMethod]
|
||||
public void ShouldParseWithExtraColumns()
|
||||
{
|
||||
string line = $"{NOW:dd.MM.yy HH:mm:ss};RING;2;012345678901;9876543;SIP0;EXTRA;COLUMN;";
|
||||
string line = $"{_now:dd.MM.yy HH:mm:ss};RING;2;012345678901;9876543;SIP0;EXTRA;COLUMN;";
|
||||
var result = CallMonitorEventArgs.Parse(line);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.AreEqual("012345678901", result.ExternalNumber);
|
||||
|
||||
Reference in New Issue
Block a user