mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-29 16:11:05 +01:00
Merge pull request #659 from tgstation/658-WrongModel [NugetDeploy]
Corrects IDreamDaemonClient.Start()'s return type
This commit is contained in:
@@ -33,7 +33,7 @@ namespace Tgstation.Server.Client.Components
|
||||
public Task Shutdown(CancellationToken cancellationToken) => apiClient.Delete(Routes.DreamDaemon, instance.Id, cancellationToken);
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<DreamDaemon> Start(CancellationToken cancellationToken) => apiClient.Create<DreamDaemon>(Routes.DreamDaemon, instance.Id, cancellationToken);
|
||||
public Task<Job> Start(CancellationToken cancellationToken) => apiClient.Create<Job>(Routes.DreamDaemon, instance.Id, cancellationToken);
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<DreamDaemon> Read(CancellationToken cancellationToken) => apiClient.Read<DreamDaemon>(Routes.DreamDaemon, instance.Id, cancellationToken);
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Tgstation.Server.Client.Components
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> resulting in the <see cref="DreamDaemon"/> information</returns>
|
||||
Task<DreamDaemon> Start(CancellationToken cancellationToken);
|
||||
Task<Job> Start(CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Shutdown <see cref="DreamDaemon"/>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<DebugType>Full</DebugType>
|
||||
<Version>4.0.0.0-preview9107</Version>
|
||||
<Version>4.0.0.0-preview9108</Version>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<Authors>Cyberboss</Authors>
|
||||
<Company>/tg/station 13</Company>
|
||||
@@ -24,6 +24,7 @@
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<WarningsAsErrors />
|
||||
<DocumentationFile>bin\Release\netstandard2.0\Tgstation.Server.Client.xml</DocumentationFile>
|
||||
<WarningLevel>0</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Api;
|
||||
using Tgstation.Server.Api.Models;
|
||||
|
||||
namespace Tgstation.Server.Client.Components.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public sealed class TestDreamDaemonClient
|
||||
{
|
||||
[TestMethod]
|
||||
public async Task TestStart()
|
||||
{
|
||||
var example = new Job
|
||||
{
|
||||
Id = 347,
|
||||
StartedAt = DateTimeOffset.Now
|
||||
};
|
||||
|
||||
var inst = new Instance
|
||||
{
|
||||
Id = 4958
|
||||
};
|
||||
|
||||
var mockApiClient = new Mock<IApiClient>();
|
||||
mockApiClient.Setup(x => x.Create<Job>(Routes.DreamDaemon, inst.Id, It.IsAny<CancellationToken>())).Returns(Task.FromResult(example));
|
||||
|
||||
var client = new DreamDaemonClient(mockApiClient.Object, inst);
|
||||
|
||||
var result = await client.Start(default).ConfigureAwait(false);
|
||||
Assert.AreSame(example, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user