57 lines
1.9 KiB
C#
57 lines
1.9 KiB
C#
using Furniture.DAL.Caching;
|
|
using Furniture.DAL.Adapters;
|
|
using Furniture.DAL.Providers;
|
|
using Furniture.DAL.Repositories;
|
|
using System.Reflection;
|
|
|
|
namespace Furniture.DAL.UnitTests;
|
|
|
|
public class BoundaryShapeTests
|
|
{
|
|
[Fact]
|
|
public void ProviderBoundaries_WhenReflected_AreInterfaces()
|
|
{
|
|
Assert.True(typeof(IFurnitureDataProvider).IsInterface);
|
|
Assert.True(typeof(ICatalogDataProvider).IsInterface);
|
|
}
|
|
|
|
[Fact]
|
|
public void RepositoryAndCacheBoundaries_WhenReflected_AreInterfaces()
|
|
{
|
|
Assert.True(typeof(IFurnitureRepository).IsInterface);
|
|
Assert.True(typeof(ICatalogRepository).IsInterface);
|
|
Assert.True(typeof(ICacheInvalidationPolicy).IsInterface);
|
|
}
|
|
|
|
[Fact]
|
|
public void RepositoryBoundaries_WhenReflected_ExposeReadOnlyContracts()
|
|
{
|
|
Assert.Equal("ReadAvailabilityAsync", typeof(IFurnitureRepository).GetMethods().Single().Name);
|
|
Assert.Equal("ReadProductAsync", typeof(ICatalogRepository).GetMethods().Single().Name);
|
|
}
|
|
|
|
[Fact]
|
|
public void ProviderBoundaries_WhenReflected_ExposeReadOnlyContracts()
|
|
{
|
|
Assert.Equal("ReadAvailabilityAsync", typeof(IFurnitureDataProvider).GetMethods().Single().Name);
|
|
Assert.Equal("ReadProductAsync", typeof(ICatalogDataProvider).GetMethods().Single().Name);
|
|
}
|
|
|
|
[Fact]
|
|
public void AdapterBoundaries_WhenReflected_AreInterfaces()
|
|
{
|
|
Assert.True(typeof(IFurnitureDalGrpcContractAdapter).IsInterface);
|
|
Assert.True(typeof(ICatalogProjectionContractAdapter).IsInterface);
|
|
|
|
var grpcMethodNames = typeof(IFurnitureDalGrpcContractAdapter)
|
|
.GetMethods(BindingFlags.Public | BindingFlags.Instance)
|
|
.Select(method => method.Name)
|
|
.OrderBy(name => name)
|
|
.ToArray();
|
|
|
|
Assert.Equal(
|
|
["FromGrpcAvailabilityRequest", "FromGrpcCatalogRequest", "ToGrpcAvailabilityRequest", "ToGrpcCatalogRequest"],
|
|
grpcMethodNames);
|
|
}
|
|
}
|