ProfileSharp.Store.FileStore
7.0.0.3-prerelease
dotnet add package ProfileSharp.Store.FileStore --version 7.0.0.3-prerelease
NuGet\Install-Package ProfileSharp.Store.FileStore -Version 7.0.0.3-prerelease
<PackageReference Include="ProfileSharp.Store.FileStore" Version="7.0.0.3-prerelease" />
paket add ProfileSharp.Store.FileStore --version 7.0.0.3-prerelease
#r "nuget: ProfileSharp.Store.FileStore, 7.0.0.3-prerelease"
// Install ProfileSharp.Store.FileStore as a Cake Addin #addin nuget:?package=ProfileSharp.Store.FileStore&version=7.0.0.3-prerelease&prerelease // Install ProfileSharp.Store.FileStore as a Cake Tool #tool nuget:?package=ProfileSharp.Store.FileStore&version=7.0.0.3-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 could change as it matures.
Planned Features
- Automatic Unit Test Generation and Execution at Runtime within your unit tests based on profiled data.
Drawbacks
- Mock data can only be collected at runtime.
- If the signature of a mocked method changes it will no longer be compatible with preivously profiled mocking data.
- 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.
- Only methods and properties can profiled/mocked.
How?
Install the ProfileSharp.AspNetCore
package from nuget.
In your Startup.cs
call the following methods.
public void ConfigureServices(IServiceCollection services)
{
services.AddProfileSharp(config =>
{
config.AddProfiling(o => o.UseFileStore(@"D:\#temp\ProfilingStore"));
config.AddMocking(o => o.UseFileStore(@"D:\#temp\ProfilingStore"));
if(env.IsDevelopment())
{
// Enable Mocking Mode, when this mode is set ProfileSharp will mock the
// specified parts of your domain.
config.SetMode(ProfileSharpMode.Mocking);
}
else if(env.IsStaging())
{
// Enable Profiling Mode, when this mode is set ProfileSharp will profile the
// specified parts of your domain.
config.SetMode(ProfileSharpMode.Profiling);
}
});
}
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);
}
Releases
Package | Downloads | NuGet |
---|---|---|
ProfileSharp | ||
ProfileSharp.AspNetCore | ||
ProfileSharp.NServiceBus | ||
ProfileSharp.Store.FileStore |
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
- Newtonsoft.Json (>= 9.0.1)
- ProfileSharp (>= 7.0.0.3-prerelease)
-
net5.0
- Newtonsoft.Json (>= 9.0.1)
- ProfileSharp (>= 7.0.0.3-prerelease)
-
net6.0
- Newtonsoft.Json (>= 9.0.1)
- ProfileSharp (>= 7.0.0.3-prerelease)
-
net7.0
- Newtonsoft.Json (>= 9.0.1)
- ProfileSharp (>= 7.0.0.3-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 | 129 | 12/21/2022 |
7.0.0.2-prerelease | 122 | 12/20/2022 |
7.0.0.1-prerelease | 105 | 12/19/2022 |