Skip to content

Commit

Permalink
Added culture for DimensionTests. (#12)
Browse files Browse the repository at this point in the history
When you haven't "en-US" the test will fail
  • Loading branch information
APOSWE authored Dec 18, 2023
1 parent fc46932 commit 7eace3a
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion src/IxMilia.Converters.Test/DimensionTests.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Xunit;

namespace IxMilia.Converters.Test
{
public class DimensionTests
public class DimensionTests : IDisposable
{
private readonly CultureInfo originalCulture;
private bool disposedValue;

public DimensionTests()
{
// Store the original culture
originalCulture = CultureInfo.CurrentCulture;

// Set the desired culture (e.g., en-US)
var culture = new CultureInfo("en-US");
CultureInfo.CurrentCulture = culture;
CultureInfo.CurrentUICulture = culture;
}

[Theory]
[InlineData(3.0, "3", 0, DrawingUnits.English, UnitFormat.Decimal)] // nearest whole number
[InlineData(3.4, "3", 0, DrawingUnits.English, UnitFormat.Decimal)]
Expand Down Expand Up @@ -219,5 +234,38 @@ public static IEnumerable<object[]> GenerateLinearDimensionsProperties()
private static (Vector, Vector)[] Round((Vector, Vector)[] value) => value.Select(Round).ToArray();

private static (Vector, Vector, Vector)[] Round((Vector, Vector, Vector)[] value) => value.Select(Round).ToArray();

protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
if (disposing)
{
// TODO: Verwalteten Zustand (verwaltete Objekte) bereinigen
}

// TODO: Nicht verwaltete Ressourcen (nicht verwaltete Objekte) freigeben und Finalizer überschreiben
// TODO: Große Felder auf NULL setzen
disposedValue = true;
}
}

// // TODO: Finalizer nur überschreiben, wenn "Dispose(bool disposing)" Code für die Freigabe nicht verwalteter Ressourcen enthält
// ~DimensionTests()
// {
// // Ändern Sie diesen Code nicht. Fügen Sie Bereinigungscode in der Methode "Dispose(bool disposing)" ein.
// Dispose(disposing: false);
// }

void IDisposable.Dispose()
{
// Reset the culture to the original value in the Dispose method
CultureInfo.CurrentCulture = originalCulture;
CultureInfo.CurrentUICulture = originalCulture;

// Ändern Sie diesen Code nicht. Fügen Sie Bereinigungscode in der Methode "Dispose(bool disposing)" ein.
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
}
}

0 comments on commit 7eace3a

Please sign in to comment.