Files
Artemy 6d1c53beeb Refactor: migrate Core -> Domain and reorganize projects
Large refactor that renames/moves core types into a new Govor.Domain surface and reorganizes the Application layer. Models, configurations, migrations and many files moved from Govor.Core/Govor.Data to Govor.Domain; numerous Application services, interfaces and implementations were relocated or added (authentication, friends, messages, medias, push notifications, user sessions, storage, synching, private chats, etc.). Tests updated to use Govor.Domain namespaces and adjusted project references (removed Govor.Data reference from API tests). Also updated API, Hub and mapping code and project files to reflect the new structure and naming. This is primarily a codebase-wide namespace and module reorganization to establish a Domain project and restructure application services.
2026-07-16 19:27:45 +07:00

105 lines
2.5 KiB
C#

using Govor.Application.Synching;
namespace Govor.Application.Tests.Services;
[TestFixture]
public class SynchingServiceTests
{
private readonly SynchingService _sut; // System Under Test
public SynchingServiceTests()
{
_sut = new SynchingService();
}
[Test]
public void NormalizeNewlines_ShouldReturnEmptyString_WhenInputIsEmpty()
{
// Act
var result = _sut.NormalizeNewlines(string.Empty);
// Assert
Assert.That(result, Is.EqualTo(string.Empty));
}
[Test]
public void NormalizeNewlines_ShouldReturnNull_WhenInputIsNull()
{
// Arrange
string input = null;
// Act
var result = _sut.NormalizeNewlines(input);
// Assert
Assert.That(result, Is.Null);
}
[Test]
public void NormalizeNewlines_ShouldNotChangeUnixStyleNewlines_WhenInputIsLF()
{
// Arrange
const string input = "Line 1\nLine 2\nLine 3";
// Act
var result = _sut.NormalizeNewlines(input);
// Assert
Assert.That(result, Is.EqualTo(input));
}
[Test]
public void NormalizeNewlines_ShouldConvertWindowsStyleNewlines_WhenInputIsCRLF()
{
// Arrange
const string input = "Line 1\r\nLine 2\r\nLine 3";
const string expected = "Line 1\nLine 2\nLine 3";
// Act
var result = _sut.NormalizeNewlines(input);
// Assert
Assert.That(result, Is.EqualTo(expected));
}
[Test]
public void NormalizeNewlines_ShouldConvertMacStyleNewlines_WhenInputIsCR()
{
// Arrange
const string input = "Line 1\rLine 2\rLine 3";
const string expected = "Line 1\nLine 2\nLine 3";
// Act
var result = _sut.NormalizeNewlines(input);
// Assert
Assert.That(result, Is.EqualTo(expected));
}
[Test]
public void NormalizeNewlines_ShouldHandleMixedNewlines_WhenInputIsMixed()
{
// Arrange
const string input = "Line 1\r\nLine 2\rLine 3\nLine 4";
const string expected = "Line 1\nLine 2\nLine 3\nLine 4";
// Act
var result = _sut.NormalizeNewlines(input);
// Assert
Assert.That(result, Is.EqualTo(expected));
}
[Test]
public void NormalizeNewlines_ShouldHandleTextWithoutNewlines()
{
// Arrange
const string input = "This is a single line of text.";
// Act
var result = _sut.NormalizeNewlines(input);
// Assert
Assert.That(result, Is.EqualTo(input));
}
}