mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-29 11:54:27 +01:00
27 lines
742 B
C#
27 lines
742 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Xunit;
|
|
|
|
namespace BTCPayServer.Tests
|
|
{
|
|
public static class Extensions
|
|
{
|
|
public static T AssertViewModel<T>(this IActionResult result)
|
|
{
|
|
Assert.NotNull(result);
|
|
var vr = Assert.IsType<ViewResult>(result);
|
|
return Assert.IsType<T>(vr.Model);
|
|
}
|
|
public static async Task<T> AssertViewModelAsync<T>(this Task<IActionResult> task)
|
|
{
|
|
var result = await task;
|
|
Assert.NotNull(result);
|
|
var vr = Assert.IsType<ViewResult>(result);
|
|
return Assert.IsType<T>(vr.Model);
|
|
}
|
|
}
|
|
}
|