Files
UnrealEngineUWP/Engine/Source/Programs/Horde/Horde.Build.Tests/AgentControllerTest.cs
T
Ben Marsh 84c453ad8f Horde: Move files into namespaces corresponding to their location on disk.
#preflight none

[CL 20543973 by Ben Marsh in ue5-main branch]
2022-06-07 15:53:33 -04:00

32 lines
977 B
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System.Threading.Tasks;
using Horde.Build.Agents;
using Microsoft.AspNetCore.Mvc;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Horde.Build.Tests;
[TestClass]
public class AgentControllerDbTest : TestSetup
{
[TestMethod]
public async Task UpdateAgent()
{
Fixture fixture = await CreateFixtureAsync();
IAgent fixtureAgent = fixture.Agent1;
ActionResult<object> obj = await AgentsController.GetAgentAsync(fixtureAgent.Id);
GetAgentResponse getRes = (obj.Value as GetAgentResponse)!;
Assert.AreEqual(fixture!.Agent1Name.ToUpper(), getRes.Name);
Assert.IsNull(getRes.Comment);
UpdateAgentRequest updateReq = new();
updateReq.Comment = "foo bar baz";
await AgentsController.UpdateAgentAsync(fixtureAgent.Id, updateReq);
obj = await AgentsController.GetAgentAsync(fixtureAgent.Id);
getRes = (obj.Value as GetAgentResponse)!;
Assert.AreEqual("foo bar baz", getRes.Comment);
}
}