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

OSOE-815: Using simpler NPM dependencies to test ConstantFromJsonAttribute #308

Merged
merged 1 commit into from
Dec 29, 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
15 changes: 10 additions & 5 deletions Lombiq.HelpfulLibraries.Tests/Models/ConstantFromJsonSample.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
using Lombiq.HelpfulLibraries.Attributes;
using Lombiq.HelpfulLibraries.Attributes;

namespace Lombiq.HelpfulLibraries.Tests.Models;

/// <summary>
/// Shows how to use the <see cref="ConstantFromJsonAttribute" />.
/// </summary>
[ConstantFromJson(constantName: "GulpUglifyVersion", fileName: "package.json", propertyName: "gulp-uglify")]
[ConstantFromJson(constantName: "GulpVersion", fileName: "package.json", propertyName: "gulp")]
/// <remarks>
/// <para>
/// Using two really simple packages as a test.
/// </para>
/// </remarks>
[ConstantFromJson(constantName: "IsEvenVersion", fileName: "package.json", propertyName: "is-even")]
[ConstantFromJson(constantName: "IsOddVersion", fileName: "package.json", propertyName: "is-odd")]
public partial class ConstantFromJsonSample
{
public string ReturnVersions()
{
var stringBuilder = new System.Text.StringBuilder();
stringBuilder.AppendLine($"Gulp version: {GulpVersion}");
stringBuilder.AppendLine($"Gulp-uglify version: {GulpUglifyVersion}");
stringBuilder.AppendLine($"is-even version: {IsEvenVersion}");
stringBuilder.AppendLine($"is-odd version: {IsOddVersion}");
return stringBuilder.ToString();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Lombiq.HelpfulLibraries.Tests.Models;
using Lombiq.HelpfulLibraries.Tests.Models;
using Shouldly;
using System;
using Xunit;
Expand All @@ -10,11 +10,11 @@ public class ConstantFromJsonTest
[Fact]
public void TestGeneratedConstants()
{
ConstantFromJsonSample.GulpVersion.ShouldBe("3.9.0");
ConstantFromJsonSample.GulpUglifyVersion.ShouldBe("1.4.1");
ConstantFromJsonSample.IsEvenVersion.ShouldBe("1.0.0");
ConstantFromJsonSample.IsOddVersion.ShouldBe("3.0.1");
new ConstantFromJsonSample()
.ReturnVersions()
.Split(["\n", "\r"], StringSplitOptions.RemoveEmptyEntries)
.ShouldBe(["Gulp version: 3.9.0", "Gulp-uglify version: 1.4.1"]);
.ShouldBe(["is-even version: 1.0.0", "is-odd version: 3.0.1"]);
}
}
19 changes: 2 additions & 17 deletions Lombiq.HelpfulLibraries.Tests/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
{
"private": true,
"devDependencies": {
"fs": "0.0.2",
"glob": "5.0.15",
"path-posix": "1.0.0",
"merge-stream": "1.0.0",
"gulp-if": "2.0.0",
"gulp": "3.9.0",
"gulp-newer": "0.5.1",
"gulp-plumber": "1.0.1",
"gulp-sourcemaps": "1.6.0",
"gulp-less": "3.0.3",
"gulp-autoprefixer": "2.2.0",
"gulp-minify-css": "1.2.1",
"gulp-typescript": "2.9.2",
"gulp-uglify": "1.4.1",
"gulp-rename": "1.2.2",
"gulp-concat": "2.6.0",
"gulp-header": "1.7.1"
"is-even": "1.0.0",
"is-odd": "3.0.1"
},
"dependencies": { }
}
Loading