Skip to content

Commit

Permalink
visual studio community has some funky behavior when referencing a .n…
Browse files Browse the repository at this point in the history
…et 4.8.1 project from .net 6.0. Bit of a nuisance to work with, while dotnet build and test works fine. hence switching to .net 4.8.1 for a bit until this is resolved.
  • Loading branch information
FrankvdStam committed Sep 8, 2023
1 parent 4f3639e commit 5212d28
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 19 deletions.
Binary file modified Components/SoulSplitter.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/SoulSplitter.Tests/SoulComponentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void SetSettingsTest()

Assert.AreEqual(viewModel.EldenRingViewModel.StartAutomatically, deserializedViewModel.EldenRingViewModel.StartAutomatically);

var vectorSize = deserializedViewModel.SekiroViewModel.SplitsViewModel.Splits.FirstOrDefault()!.Children.FirstOrDefault()!.Children.FirstOrDefault()!.Split;
var vectorSize = deserializedViewModel.SekiroViewModel.SplitsViewModel.Splits.FirstOrDefault().Children.FirstOrDefault().Children.FirstOrDefault().Split;

Assert.AreEqual(typeof(VectorSize), vectorSize.GetType());
Assert.AreEqual(1.0f, ((VectorSize)vectorSize).Position.X);
Expand Down
4 changes: 2 additions & 2 deletions tests/SoulSplitter.Tests/SoulSplitter.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net481</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PlatformTarget>x64</PlatformTarget>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
<Platforms>x64</Platforms>
<ImplicitUsings>disable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions tests/SoulSplitter.Tests/Splitters/SplitterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public void AutoSplitTests()
break;

case SplitType.Bonfire:
darkSouls1.GetBonfireState(((Splits.DarkSouls1.BonfireState)split.Split).Bonfire!.Value).Returns(((Splits.DarkSouls1.BonfireState)split.Split).State);
darkSouls1.GetBonfireState(((Splits.DarkSouls1.BonfireState)split.Split).Bonfire.Value).Returns(((Splits.DarkSouls1.BonfireState)split.Split).State);
break;

case SplitType.Position:
Expand Down Expand Up @@ -238,7 +238,7 @@ public void AutoSplitTests()
//It seems like GameTime might be updated from somewhere else. The logic inside livesplit is complicated.
//I noticed that its value (in millis) can be 51.6 after setting it to 50.0
//If this asserts starts being funny, just get rid of it.
Assert.AreEqual(igt, timerModel.CurrentState.CurrentTime.GameTime!.Value.TotalMilliseconds);
Assert.AreEqual(igt, timerModel.CurrentState.CurrentTime.GameTime.Value.TotalMilliseconds);

darkSouls1.GetPosition().Returns(new SoulMemory.Vector3f());//reset position
}
Expand Down
5 changes: 3 additions & 2 deletions tests/SoulSplitter.Tests/TestMethodSTAAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace SoulSplitter.Net6.Tests
Expand All @@ -22,15 +23,15 @@ public class TestMethodSTAAttribute : TestMethodAttribute
{
public override TestResult[] Execute(ITestMethod testMethod)
{
TestResult? result = null;
TestResult result = null;
var thread = new Thread(() =>
{
result = testMethod.Invoke(null);
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
return new []{ result! };
return new []{ result };
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SoulSplitter.UI.Converters;
using System.Windows;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

using System.Threading;
using System.Windows.Data;

namespace SoulSplitter.Tests.UI.Converters
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// This file is part of the SoulSplitter distribution (https://github.com/FrankvdStam/SoulSplitter).
// Copyright (c) 2022 Frank van der Stam.
// https://github.com/FrankvdStam/SoulSplitter/blob/main/LICENSE
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

using Microsoft.VisualStudio.TestTools.UnitTesting;
using SoulSplitter.UI.Converters;

namespace SoulSplitter.Tests.UI.Converters
{
[TestClass]
public class EnumDisplayNameConverterTests
{
[TestMethod]
public void Convert_Ds1_Boss()
{
var converter = new EnumDisplayNameConverter();
Assert.AreEqual("Capra Demon", converter.Convert(SoulMemory.DarkSouls1.Boss.CapraDemon));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,27 @@ namespace SoulSplitter.Tests.UI.Validation
[TestClass]
public class TextToNumberValidationTests
{
private static IEnumerable<object?[]> TestCases
private static IEnumerable<object[]> TestCases
{
get
{
return new []
{
new object?[] { "123" , false, false, NumericType.Uint , true },
new object?[] { "-123" , false, false, NumericType.Uint , false},
new object?[] { "-123" , false, true , NumericType.Int , true },
new object?[] { "123.3", false, true , NumericType.Int , false},
new object?[] { "123.3", false, true , NumericType.Float, true },
new object?[] { "" , true , true , NumericType.Float, false},
new object?[] { "asd" , true , true , NumericType.Float, false},
new object?[] { null , true , true , NumericType.Float, false},
new object[] { "123" , false, false, NumericType.Uint , true },
new object[] { "-123" , false, false, NumericType.Uint , false},
new object[] { "-123" , false, true , NumericType.Int , true },
new object[] { "123.3", false, true , NumericType.Int , false},
new object[] { "123.3", false, true , NumericType.Float, true },
new object[] { "" , true , true , NumericType.Float, false},
new object[] { "asd" , true , true , NumericType.Float, false},
new object[] { null , true , true , NumericType.Float, false},
};
}
}

[TestMethod]
[DynamicData(nameof(TestCases))]
public void TestDataTypes(object? value, bool isRequired, bool allowNegative, NumericType numericType, bool expected)
public void TestDataTypes(object value, bool isRequired, bool allowNegative, NumericType numericType, bool expected)
{
var validator = new TextToNumberValidation { AllowNegative = allowNegative, IsRequired = isRequired, NumericType = numericType };
Assert.AreEqual(expected, validator.Validate(value, CultureInfo.InvariantCulture).IsValid);
Expand Down
4 changes: 2 additions & 2 deletions tests/SoulSplitter.Tests/UI/ViewModelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class ViewModelTests
[DynamicData(nameof(TestCases))]
public void AddSplitTest(GameType gameType, AddSplit addSplit, TimingType timingType, SplitType splitType, object split)
{
BaseViewModel? viewModel = null;
BaseViewModel viewModel = null;
switch(gameType)
{
case GameType.DarkSouls1:
Expand Down Expand Up @@ -98,7 +98,7 @@ public void AddMultipleSplits()
var expectedTimingTypes = new Dictionary<TimingType, int>();
var expectedSplitTypes = new Dictionary<SplitType, int>();

BaseViewModel? viewModel = null;
BaseViewModel viewModel = null;
switch (gameType.Key)
{
case GameType.DarkSouls1:
Expand Down

0 comments on commit 5212d28

Please sign in to comment.