mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 18:11:36 +01:00
32 lines
928 B
C#
32 lines
928 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using OpenQA.Selenium;
|
|
using Xunit;
|
|
|
|
namespace BTCPayServer.Tests
|
|
{
|
|
public static class Extensions
|
|
{
|
|
public static void AssertNoError(this IWebDriver driver)
|
|
{
|
|
Assert.NotNull(driver.FindElement(By.ClassName("navbar-brand")));
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
}
|