Files
speckle-sharp-connectors/Sdk/Speckle.Testing/MoqTest.cs
T
Adam Hathcock d15d170b7c update(dev) Use SDK 3.2.1 (#785)
* Revert "main (revert)  Back to sdk 3.1.8 (#777)"

This reverts commit 4a8bde2ed6.

* update to 3.2.1

---------

Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com>
2025-04-29 14:26:14 +03:00

31 lines
836 B
C#

using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
using Moq;
using NUnit.Framework;
using Speckle.Sdk;
namespace Speckle.Testing;
[ExcludeFromCodeCoverage]
public abstract class MoqTest
{
[SetUp]
public void Setup() => Repository = new(MockBehavior.Strict);
[TearDown]
public void Verify() => Repository.VerifyAll();
protected MockRepository Repository { get; private set; } = new(MockBehavior.Strict);
protected Mock<T> Create<T>(MockBehavior behavior = MockBehavior.Strict)
where T : class => Repository.Create<T>(behavior);
protected IServiceCollection CreateServices(params Assembly[] assemblies)
{
var services = new ServiceCollection();
services.AddSpeckleSdk(new("Tests", "tests"), "test", assemblies);
return services;
}
}