ProfileSharp.NServiceBus
7.0.0.1-prerelease
See the version list below for details.
dotnet add package ProfileSharp.NServiceBus --version 7.0.0.1-prerelease
NuGet\Install-Package ProfileSharp.NServiceBus -Version 7.0.0.1-prerelease
<PackageReference Include="ProfileSharp.NServiceBus" Version="7.0.0.1-prerelease" />
paket add ProfileSharp.NServiceBus --version 7.0.0.1-prerelease
#r "nuget: ProfileSharp.NServiceBus, 7.0.0.1-prerelease"
// Install ProfileSharp.NServiceBus as a Cake Addin #addin nuget:?package=ProfileSharp.NServiceBus&version=7.0.0.1-prerelease&prerelease // Install ProfileSharp.NServiceBus as a Cake Tool #tool nuget:?package=ProfileSharp.NServiceBus&version=7.0.0.1-prerelease&prerelease
ProfileSharp was built to allow developers to quickly test on their local machines and automate unit tests without manually generating a large amount of mock data. ProfileSharp provides an easy way to collect mock data and enable its use within your domain.
NOTE: This is an early proof of concept and will change as it matures.
Planned Features
- Automatic Unit Test Generation and Execution at Runtime within your unit tests based on profiled data.
Drawbacks
- Random data is not supported in unit tests. (This may be resolved with an Attribute or alternative means in the future)
- Mocking is currently only supported within an AspNet runtime.
- Constructors, Events, and Properties are presently not supported.
How?
Install the ProfileSharp.AspNetCore
package from nuget.
In your Startup.cs
call the following methods.
public void ConfigureServices(IServiceCollection services)
{
services.AddProfileSharp(o =>
{
o.AddProfiling(o =>
{
o.UseFileStore(@"D:\#temp\ProfilingStore");
});
o.AddMocking(o =>
{
o.UseFileStore(@"D:\#temp\ProfilingStore");
});
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseProfileSharp(config =>
{
if(env.IsDevelopment())
{
// Enable Mocking Mode, when this mode is set ProfileSharp will mock the
// specified parts of your domain.
config.EnableMocking();
}
else if(env.IsStaging())
{
// Enable Profiling Mode, when this mode is set ProfileSharp will profile the
// specified parts of your domain.
config.EnableProfiling();
}
else
{
// Disable ProfileSharp, Mocking and Profiling will not occur.
config.Disable();
}
});
}
If your project is using NServiceBus
Install the ProfileSharp.NServiceBus
package from nuget.
When configuration your EndpointConfiguration
call the following methods
endpointConfiguration.UseProfileSharp();
ProfileSharp Attributes
For ProfileSharp to work, you must specify what parts of your domain will be intercepted. This is done using the EnableProfileSharpAttribute
.
[EnableProfileSharp]
public interface IStudentRepository
{
Task CreateAsync(StudentModel student);
Task<StudentModel> GetAsync(Guid studentId);
Task DeleteAsync(Guid studentId);
}
You can also only enable ProfileSharp for specific methods.
public interface IStudentRepository
{
// This method will not intercepted.
Task CreateAsync(StudentModel student);
[EnableProfileSharp]
Task<StudentModel> GetAsync(Guid studentId);
// This method will not intercepted.
Task DeleteAsync(Guid studentId);
}
Or disable ProfileSharp for specific methods.
[EnableProfileSharp]
public interface IStudentRepository
{
Task CreateAsync(StudentModel student);
Task<StudentModel> GetAsync(Guid studentId);
// This method will not intercepted.
[DisableProfileSharp]
Task DeleteAsync(Guid studentId);
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- NServiceBus (>= 7.8.2)
- ProfileSharp (>= 7.0.0.1-prerelease)
-
net5.0
- NServiceBus (>= 7.8.2)
- ProfileSharp (>= 7.0.0.1-prerelease)
-
net6.0
- NServiceBus (>= 7.8.2)
- ProfileSharp (>= 7.0.0.1-prerelease)
-
net7.0
- NServiceBus (>= 7.8.2)
- ProfileSharp (>= 7.0.0.1-prerelease)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
7.0.0.3-prerelease | 138 | 12/21/2022 |
7.0.0.2-prerelease | 121 | 12/20/2022 |
7.0.0.1-prerelease | 107 | 12/19/2022 |