Skip to content

Commit

Permalink
Removed all Windows requirements.
Browse files Browse the repository at this point in the history
Upgraded all tests & testing frameworks.
Updated to minimum requirement of .net 8.
  • Loading branch information
DJGosnell committed Jun 27, 2024
1 parent 7f9577a commit 2743372
Show file tree
Hide file tree
Showing 57 changed files with 2,682 additions and 3,115 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.*
dotnet-version: 8.0.*
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
Expand Down
14 changes: 9 additions & 5 deletions src/DtronixPackage.Tests/DtronixPackage.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NLog" Version="4.7.8" />
<PackageReference Include="nunit" Version="3.13.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0-alpha.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="NLog" Version="5.3.2" />
<PackageReference Include="nunit" Version="4.1.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public IntegrationTestBase()

}


[OneTimeSetUp]
public virtual void OneTimeSetup()
{
Expand Down Expand Up @@ -88,7 +89,7 @@ public virtual void Setup()
[TearDown]
public virtual void TearDown()
{

TestComplete?.Dispose();
}

protected void WaitTest(int milliseconds = 500)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public async Task SetsIsDataModifiedSinceAutoSaveToFalse()
await file.ConfigureAutoSave(0, -1, true);

await Utilities.AssertFileExistWithin(tempSave);
Assert.IsFalse(file.IsDataModifiedSinceAutoSave);
Assert.That(file.IsDataModifiedSinceAutoSave, Is.False);
}

[Test]
Expand All @@ -81,9 +81,9 @@ public void IsDataModifiedSinceAutoSaveIsModified()
{
TempPackagePathRequest = () => tempSave
};
Assert.IsFalse(file.IsDataModifiedSinceAutoSave);
Assert.That(file.IsDataModifiedSinceAutoSave, Is.False);
file.ContentModifiedOverride();
Assert.IsTrue(file.IsDataModifiedSinceAutoSave);
Assert.That(file.IsDataModifiedSinceAutoSave, Is.True);
}

[Test]
Expand All @@ -98,7 +98,7 @@ public async Task DoesNotChangeIsDataModified()
await file.ConfigureAutoSave(0, -1, true);
await Utilities.AssertFileExistWithin(tempSave);

Assert.IsTrue(file.IsContentModified);
Assert.That(file.IsContentModified, Is.True);
}

[Test]
Expand Down Expand Up @@ -130,7 +130,7 @@ public async Task SavesAgainAfterDataIsModified()

lastWriteTime = new FileInfo(tempSave).LastWriteTime;
}
Assert.AreNotEqual(initialWriteTime, lastWriteTime);
Assert.That(lastWriteTime, Is.Not.EqualTo(initialWriteTime));

await file.ConfigureAutoSave(-1, -1, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class PackageTests_ChangeMonitor : IntegrationTestBase

private void MonitorChangesTests(DynamicPackageData package, Action test)
{
Assert.IsFalse(package.IsContentModified);
Assert.That(package.IsContentModified, Is.False);
package.Data.Children.Add(new PackageDataContractChild());
test.Invoke();

Expand Down Expand Up @@ -49,15 +49,15 @@ private void MonitorChangesTests(DynamicPackageData package, Action test)
public void RegistersChanges()
{
var package = new DynamicPackageData(new Version(1,0), this);
MonitorChangesTests(package, () => Assert.IsTrue(package.IsContentModified));
MonitorChangesTests(package, () => Assert.That(package.IsContentModified, Is.True));
}

[Test]
public void DeRegistersChanges()
{
var package = new DynamicPackageData(new Version(1,0), this);
package.MonitorDeregisterOverride(package.Data);
MonitorChangesTests(package, () => Assert.IsFalse(package.IsContentModified));
MonitorChangesTests(package, () => Assert.That(package.IsContentModified, Is.False));
}

[Test]
Expand All @@ -70,7 +70,7 @@ public void IgnoresChanges()
package.Data.Children.Add(new PackageDataContractChild());
});

Assert.IsFalse(package.IsContentModified);
Assert.That(package.IsContentModified, Is.False);
}

[Test]
Expand All @@ -83,7 +83,7 @@ public void IgnoresChangesAfterClosing()

subTypeInstance.Value = "test 2";

Assert.IsFalse(package.IsContentModified);
Assert.That(package.IsContentModified, Is.False);
}


Expand Down
20 changes: 10 additions & 10 deletions src/DtronixPackage.Tests/IntegrationTests/PackageTests_Content.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public async Task WritesAndReadsJson()
await OpenWaitForCompletionPackage(async (reader, file) =>
{
var readJson = await reader.ReadJson<SampleJsonObj>(ContentFileName);
Assert.AreEqual(SampleJson.Data, readJson.Data);
Assert.That(readJson.Data, Is.EqualTo(SampleJson.Data));
});
}

Expand All @@ -26,7 +26,7 @@ public async Task WritesAndReadsString()

await OpenWaitForCompletionPackage(async (reader, file) =>
{
Assert.AreEqual(SampleText, await reader.ReadString(ContentFileName));
Assert.That(await reader.ReadString(ContentFileName), Is.EqualTo(SampleText));
return true;
});
}
Expand All @@ -43,7 +43,7 @@ await OpenWaitForCompletionPackage((reader, file) =>
byte[] readBuffer = new byte[10];
stream.Read(readBuffer);

Assert.AreEqual(SampleByteArray, readBuffer);
Assert.That(readBuffer, Is.EqualTo(SampleByteArray));
return Task.FromResult(true);
});
}
Expand All @@ -52,7 +52,7 @@ await OpenWaitForCompletionPackage((reader, file) =>
public void ContentIsInstancedOnPackageCreation()
{
var package = new DynamicPackage<SimplePackageContent>(new Version(1, 0), this, false, false);
Assert.NotNull(package.Content);
Assert.That(package.Content, Is.Not.Null);
}

[Test]
Expand All @@ -73,12 +73,12 @@ public void ContentIsResetOnClose()
package.Close();
Assert.Multiple(() =>
{
Assert.AreEqual(default(byte[]), package.Content.Bytes);
Assert.AreEqual(default(byte), package.Content.Byte);
Assert.AreEqual(default(string), package.Content.String);
Assert.AreEqual(default(int), package.Content.Integer);
Assert.AreEqual(default(double), package.Content.Double);
Assert.AreEqual(default(DateTimeOffset), package.Content.DateTimeOffset);
Assert.That(package.Content.Bytes, Is.EqualTo(default(byte[])));
Assert.That(package.Content.Byte, Is.EqualTo(default(byte)));
Assert.That(package.Content.String, Is.EqualTo(default(string)));
Assert.That(package.Content.Integer, Is.EqualTo(default(int)));
Assert.That(package.Content.Double, Is.EqualTo(default(double)));
Assert.That(package.Content.DateTimeOffset, Is.EqualTo(default(DateTimeOffset)));
});
}
}
Expand Down
Loading

0 comments on commit 2743372

Please sign in to comment.