Files
tgstation-server/tests/Tgstation.Server.Tests/TestingUtils.cs
T
Dominion 51b7792e15 CachingFileDownloader now builds the cache
- New global CI cache for BYOND zips
- VersionsTest now caches the BYOND versions it tests
- Move some classes around
2023-06-14 14:53:32 -04:00

30 lines
740 B
C#

using System;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
namespace Tgstation.Server.Tests
{
static class TestingUtils
{
public static bool RunningInGitHubActions { get; } = !string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("GITHUB_RUN_ID"));
public static ILoggerFactory CreateLoggerFactoryForLogger(ILogger logger, out Mock<ILoggerFactory> mockLoggerFactory)
{
mockLoggerFactory = new Mock<ILoggerFactory>();
mockLoggerFactory.Setup(x => x.CreateLogger(It.IsAny<string>())).Returns(() =>
{
var temp = logger;
logger = null;
Assert.IsNotNull(temp);
return temp;
})
.Verifiable();
return mockLoggerFactory.Object;
}
}
}