Skip to content

Commit d3befab

Browse files
committed
nuget
1 parent 46db7a7 commit d3befab

7 files changed

+42
-19
lines changed

Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</PropertyGroup>
55

66
<PropertyGroup>
7-
<VersionPrefix>1.5.55</VersionPrefix>
7+
<Version>1.5.55</Version>
88
<PackageIcon>WireMock.Net-Logo.png</PackageIcon>
99
<PackageProjectUrl>https://github.com/WireMock-Net/WireMock.Net</PackageProjectUrl>
1010
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>

PackageReleaseNotes.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
# 1.5.55 (22 May 2024)
2-
- #1107 When only Port is provided, bind to * (Fixes #1100) [bug]
3-
4-
The full release notes can be found here: https://github.com/WireMock-Net/WireMock.Net/blob/master/CHANGELOG.md
1+
# 0.0.1-preview-01
2+
preview...

resources/WireMock.Net-LogoAspire.ico

33.7 KB
Binary file not shown.

resources/WireMock.Net-LogoAspire.png

15 KB
Loading

src/WireMock.Net.Aspire/WireMock.Net.Aspire.csproj

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4+
<Version>0.0.1-preview-01</Version>
45
<Description>Aspire extension to start a WireMock.Net server to stub an api.</Description>
56
<AssemblyTitle>WireMock.Net.Aspire</AssemblyTitle>
67
<Authors>Stef Heyenrath</Authors>
7-
<TargetFramework>net8</TargetFramework>
8+
<TargetFramework>net8.0</TargetFramework>
89
<GenerateDocumentationFile>true</GenerateDocumentationFile>
9-
<!--<NoWarn>$(NoWarn);1591;8603</NoWarn>-->
1010
<AssemblyName>WireMock.Net.Aspire</AssemblyName>
1111
<PackageId>WireMock.Net.Aspire</PackageId>
1212
<PackageTags>dotnet;aspire;wiremock;extension</PackageTags>
@@ -21,8 +21,15 @@
2121
<AssemblyOriginatorKeyFile>../WireMock.Net/WireMock.Net.snk</AssemblyOriginatorKeyFile>
2222
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
2323
<PackageLicenseExpression>MIT</PackageLicenseExpression>
24+
<PackageIcon>WireMock.Net-LogoAspire.png</PackageIcon>
25+
<ApplicationIcon>../../resources/WireMock.Net-LogoAspire.ico</ApplicationIcon>
2426
</PropertyGroup>
2527

28+
<ItemGroup>
29+
<None Remove="../../resources/WireMock.Net-Logo.png" />
30+
<None Include="../../resources/WireMock.Net-LogoAspire.png" Pack="true" PackagePath="" />
31+
</ItemGroup>
32+
2633
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
2734
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
2835
</PropertyGroup>

src/WireMock.Net.Aspire/WireMockServerArguments.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ public string[] GetArgs()
8282
return args.ToArray();
8383
}
8484

85+
private static void AddAlways(ICollection<string> args, string argument, string value)
86+
{
87+
args.Add(argument);
88+
args.Add(value);
89+
}
90+
8591
private static void AddIfNotNull(ICollection<string> args, string argument, string? value)
8692
{
8793
if (value is not null)
@@ -91,12 +97,6 @@ private static void AddIfNotNull(ICollection<string> args, string argument, stri
9197
}
9298
}
9399

94-
private static void AddAlways(ICollection<string> args, string argument, string value)
95-
{
96-
args.Add(argument);
97-
args.Add(value);
98-
}
99-
100100
private static void AddIfTrue(ICollection<string> args, string argument, bool value)
101101
{
102102
if (value)

src/WireMock.Net.Aspire/WireMockServerBuilderExtensions.cs

+24-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using Aspire.Hosting.ApplicationModel;
23
using Stef.Validation;
34

@@ -11,7 +12,7 @@ public static class WireMockServerBuilderExtensions
1112
{
1213
private const int ContainerPort = 80;
1314

14-
// https://github.com/dotnet/aspire/issues/854
15+
// Linux only (https://github.com/dotnet/aspire/issues/854)
1516
private const string DefaultLinuxImage = "sheyenrath/wiremock.net";
1617
private const string DefaultLinuxMappingsPath = "/app/__admin/mappings";
1718

@@ -28,12 +29,10 @@ public static IResourceBuilder<WireMockServerResource> AddWireMock(this IDistrib
2829
Guard.NotNullOrWhiteSpace(name);
2930
Guard.Condition(port, p => p > 0);
3031

31-
var arguments = new WireMockServerArguments
32+
return builder.AddWireMock(name, callback =>
3233
{
33-
Port = port
34-
};
35-
36-
return builder.AddWireMock(name, arguments);
34+
callback.Port = port;
35+
});
3736
}
3837

3938
/// <summary>
@@ -71,6 +70,25 @@ public static IResourceBuilder<WireMockServerResource> AddWireMock(this IDistrib
7170
return resource;
7271
}
7372

73+
/// <summary>
74+
/// Adds a WireMock.Net Server resource to the application model.
75+
/// </summary>
76+
/// <param name="builder">The <see cref="IDistributedApplicationBuilder"/>.</param>
77+
/// <param name="name">The name of the resource. This name will be used as the connection string name when referenced in a dependency.</param>
78+
/// <param name="callback">A callback that allows for setting the <see cref="WireMockServerArguments"/>.</param>
79+
/// <returns>A reference to the <see cref="IResourceBuilder{WireMockServerResource}"/>.</returns>
80+
public static IResourceBuilder<WireMockServerResource> AddWireMock(this IDistributedApplicationBuilder builder, string name, Action<WireMockServerArguments> callback)
81+
{
82+
Guard.NotNull(builder);
83+
Guard.NotNullOrWhiteSpace(name);
84+
Guard.NotNull(callback);
85+
86+
var arguments = new WireMockServerArguments();
87+
callback(arguments);
88+
89+
return builder.AddWireMock(name, arguments);
90+
}
91+
7492
/// <summary>
7593
/// Defines if the static mappings should be read at startup.
7694
///

0 commit comments

Comments
 (0)