-
-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added example NuGet Package public API snapshot testing with PublicAp…
- Loading branch information
1 parent
2ad2039
commit c9f7f45
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
Sample/EventsVersioning/EventsVersioning.Tests/SnapshotTesting/PackageSnapshotTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using ECommerce.V1; | ||
using PublicApiGenerator; | ||
|
||
namespace EventsVersioning.Tests.SnapshotTesting; | ||
|
||
public class PackageSnapshotTests | ||
{ | ||
[Fact] | ||
public Task my_assembly_has_no_public_api_changes() | ||
{ | ||
var publicApi = typeof(ShoppingCartOpened).Assembly.GeneratePublicApi(); | ||
|
||
return Verify(publicApi); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...s/SnapshotTesting/PackageSnapshotTests.my_assembly_has_no_public_api_changes.verified.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName=".NET 8.0")] | ||
namespace ECommerce.V1 | ||
{ | ||
public class PricedProductItem : System.IEquatable<ECommerce.V1.PricedProductItem> | ||
{ | ||
public PricedProductItem(ECommerce.V1.ProductItem ProductItem, decimal UnitPrice) { } | ||
public ECommerce.V1.ProductItem ProductItem { get; init; } | ||
public decimal UnitPrice { get; init; } | ||
} | ||
public class ProductItem : System.IEquatable<ECommerce.V1.ProductItem> | ||
{ | ||
public ProductItem(System.Guid ProductId, int Quantity) { } | ||
public System.Guid ProductId { get; init; } | ||
public int Quantity { get; init; } | ||
} | ||
public class ProductItemAddedToShoppingCart : System.IEquatable<ECommerce.V1.ProductItemAddedToShoppingCart> | ||
{ | ||
public ProductItemAddedToShoppingCart(System.Guid ShoppingCartId, ECommerce.V1.PricedProductItem ProductItem) { } | ||
public ECommerce.V1.PricedProductItem ProductItem { get; init; } | ||
public System.Guid ShoppingCartId { get; init; } | ||
} | ||
public class ProductItemRemovedFromShoppingCart : System.IEquatable<ECommerce.V1.ProductItemRemovedFromShoppingCart> | ||
{ | ||
public ProductItemRemovedFromShoppingCart(System.Guid ShoppingCartId, ECommerce.V1.PricedProductItem ProductItem) { } | ||
public ECommerce.V1.PricedProductItem ProductItem { get; init; } | ||
public System.Guid ShoppingCartId { get; init; } | ||
} | ||
public class ShoppingCartConfirmed : System.IEquatable<ECommerce.V1.ShoppingCartConfirmed> | ||
{ | ||
public ShoppingCartConfirmed(System.Guid ShoppingCartId, System.DateTime ConfirmedAt) { } | ||
public System.DateTime ConfirmedAt { get; init; } | ||
public System.Guid ShoppingCartId { get; init; } | ||
} | ||
public class ShoppingCartOpened : System.IEquatable<ECommerce.V1.ShoppingCartOpened> | ||
{ | ||
public ShoppingCartOpened(System.Guid ShoppingCartId, System.Guid ClientId) { } | ||
public System.Guid ClientId { get; init; } | ||
public System.Guid ShoppingCartId { get; init; } | ||
} | ||
public enum ShoppingCartStatus | ||
{ | ||
Pending = 1, | ||
Confirmed = 2, | ||
Cancelled = 3, | ||
} | ||
} |