public ErrandModel[] PopErrand([FromBody] SessionContextModel parameters) { return(_gameSessionService .PopErrand(parameters.SessionId, parameters.PlayerName) .Select(CreateErrandModel) .ToEnumerable() .ToArray()); }
public void Test_PopErrand_ReturnsErrand() { var contextModel = new SessionContextModel { SessionId = Guid.NewGuid(), PlayerName = "Player One" }; var errand = new Errand { Id = 123, Description = "Jump around or don't, I'm not your father." }; _mockGameSessionService.PopErrand(contextModel.SessionId, contextModel.PlayerName).Returns(errand.Some()); var result = Controller.PopErrand(contextModel); Assert.NotNull(result); Assert.AreEqual(1, result.Length, "There should be only one errand in array"); Assert.AreEqual(errand.Description, result[0].Description); Assert.AreEqual(errand.Id, result[0].Id); }