Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed DimensionTests when not culture en-US #12

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}
}