From f7985554630450f63589b53f895909821dcc06ef Mon Sep 17 00:00:00 2001 From: Frank Neumann Date: Thu, 29 Jan 2015 22:53:02 +0100 Subject: [PATCH] Made test code more reliable --- src/IntegrationTests/UpdateRoomTests.cs | 11 +++++------ src/IntegrationTests/ViewRoomHistoryTests.cs | 5 ++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/IntegrationTests/UpdateRoomTests.cs b/src/IntegrationTests/UpdateRoomTests.cs index 24b094b..5a5b63d 100644 --- a/src/IntegrationTests/UpdateRoomTests.cs +++ b/src/IntegrationTests/UpdateRoomTests.cs @@ -10,17 +10,16 @@ namespace IntegrationTests [Trait("UpdateRoom", "")] public class UpdateRoomTests : IDisposable { - private readonly int _createdRoomId; + private readonly int _existingRoomId; private readonly HipchatClient _client; private readonly HipchatUser _owner; public UpdateRoomTests() { HipchatApiConfig.AuthToken = TestsConfig.AuthToken; _client = new HipchatClient(); - var room = _client.CreateRoom("TestUpdateRoom"); - _createdRoomId = room.Id; + _existingRoomId = TestHelpers.GetARoomId(_client, "TestUpdateRoom"); - var getRoomResponse = _client.GetRoom(_createdRoomId); + var getRoomResponse = _client.GetRoom(_existingRoomId); _owner = getRoomResponse.Owner; } @@ -33,13 +32,13 @@ public void CanUpdateRoom() Owner = _owner }; - var result = _client.UpdateRoom(_createdRoomId, request); + var result = _client.UpdateRoom(_existingRoomId, request); Assert.True(result); } public void Dispose() { - _client.DeleteRoom(_createdRoomId); + _client.DeleteRoom(_existingRoomId); } } } \ No newline at end of file diff --git a/src/IntegrationTests/ViewRoomHistoryTests.cs b/src/IntegrationTests/ViewRoomHistoryTests.cs index 208624a..acac247 100644 --- a/src/IntegrationTests/ViewRoomHistoryTests.cs +++ b/src/IntegrationTests/ViewRoomHistoryTests.cs @@ -18,9 +18,8 @@ public ViewRoomHistoryTests() HipchatApiConfig.AuthToken = TestsConfig.AuthToken; _client = new HipchatClient(); - var room = _client.CreateRoom(roomName); - _existingRoomId = room.Id; - _existingRoomName = "Test ViewRoomHistory"; + _existingRoomId = TestHelpers.GetARoomId(_client, roomName); + _existingRoomName = roomName; // Add notifications to history _client.SendNotification(_existingRoomId, "First entry to history");