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

2.0 Feature Release #10

Merged
merged 5 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build, Pack & Publish
on:
push:
branches:
- '*'
- 'master'
tags:
- 'v*'
pull_request:
Expand All @@ -12,7 +12,7 @@ on:

jobs:
build:
runs-on: windows-latest
runs-on: windows-latest

steps:
- name: Checkout
Expand All @@ -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 All @@ -38,7 +38,7 @@ jobs:
run: dotnet pack src/DtronixPackage -c Release -o ./artifacts

- name: Export artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
path: artifacts/*

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
Loading