Skip to content

Commit

Permalink
Merge pull request #308 from Lombiq/issue/OSOE-815-helpful-libraries
Browse files Browse the repository at this point in the history
OSOE-815: Using simpler NPM dependencies to test ConstantFromJsonAttribute
  • Loading branch information
Piedone authored Dec 29, 2024
2 parents a3f07f8 + 0b17878 commit a2a659b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 26 deletions.
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": { }
}

0 comments on commit a2a659b

Please sign in to comment.