mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-04-06 12:26:10 +01:00
42 lines
920 B
C#
42 lines
920 B
C#
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
using Moq;
|
|
|
|
using Tgstation.Server.Api;
|
|
using Tgstation.Server.Api.Models.Response;
|
|
|
|
namespace Tgstation.Server.Client.Components.Tests
|
|
{
|
|
[TestClass]
|
|
public sealed class TestDreamDaemonClient
|
|
{
|
|
[TestMethod]
|
|
public async Task TestStart()
|
|
{
|
|
var example = new JobResponse
|
|
{
|
|
Id = 347,
|
|
StartedAt = DateTimeOffset.UtcNow
|
|
};
|
|
|
|
var inst = new InstanceResponse
|
|
{
|
|
Id = 4958
|
|
};
|
|
|
|
var mockApiClient = new Mock<IApiClient>();
|
|
var result2 = ValueTask.FromResult(example);
|
|
mockApiClient.Setup(x => x.Create<JobResponse>(Routes.DreamDaemon, inst.Id.Value, It.IsAny<CancellationToken>())).Returns(result2);
|
|
|
|
var client = new DreamDaemonClient(mockApiClient.Object, inst);
|
|
|
|
var result = await client.Start(default);
|
|
Assert.AreSame(example, result);
|
|
}
|
|
}
|
|
}
|