Exemplo n.º 1
0
        public GetAllWebhooksTests()
        {
            HipchatApiConfig.AuthToken = TestsConfig.AuthToken;
            _client = new HipchatClient();

            var room = _client.CreateRoom("Test Webhooks Room");

            _existingRoomId = room.Id;
        }
Exemplo n.º 2
0
        public void CanCreateRoom()
        {
            IHipchatClient client = new HipchatClient();

            var result = client.CreateRoom(RoomName);

            Assert.NotNull(result);
            Assert.NotNull(result.Links);
            Assert.NotNull(result.Links.Self);
        }
Exemplo n.º 3
0
        public void CanDeleteRoom()
        {
            const string testRoomName = "Delete Me";
            var          client       = new HipchatClient();

            client.CreateRoom(testRoomName);

            var result = client.DeleteRoom(testRoomName);

            Assert.True(result);
        }
Exemplo n.º 4
0
        public UpdateRoomTests()
        {
            HipchatApiConfig.AuthToken = TestsConfig.AuthToken;
            _client = new HipchatClient();
            var room = _client.CreateRoom("TestUpdateRoom");

            _createdRoomId = room.Id;

            var getRoomResponse = _client.GetRoom(_createdRoomId);

            _owner = getRoomResponse.Owner;
        }
Exemplo n.º 5
0
        public GetRoomTests()
        {
            const string roomName = "Test GetRooms";

            HipchatApiConfig.AuthToken = TestsConfig.AuthToken;
            _client = new HipchatClient();

            var room = _client.CreateRoom(roomName);

            _existingRoomId   = room.Id;
            _existingRoomName = "Test GetRooms";
        }
Exemplo n.º 6
0
 public static int GetARoomId(HipchatClient client, string roomName)
 {
     try
     {
         var room = client.GetRoom(roomName);
         return(room.Id);
     }
     catch (HipchatRoomNotFoundException)
     {
         var room = client.CreateRoom(roomName);
         return(room.Id);
     }
 }
Exemplo n.º 7
0
        public ViewRoomHistoryTests()
        {
            const string roomName = "Test ViewRoomHistory";

            HipchatApiConfig.AuthToken = TestsConfig.AuthToken;
            _client = new HipchatClient();

            var room = _client.CreateRoom(roomName);

            _existingRoomId   = room.Id;
            _existingRoomName = "Test ViewRoomHistory";

            // Add notifications to history
            _client.SendNotification(_existingRoomId, "First entry to history");
            _client.ShareFileWithRoom(_existingRoomId.ToString(), @"..\..\Data\RUv8sSn.png", "Second entry to history with file");
        }
Exemplo n.º 8
0
        public GetAllWebhooksTests()
        {
            HipchatApiConfig.AuthToken = TestsConfig.AuthToken;
            _client = new HipchatClient();


            try
            {
                var existingRoom = _client.GetRoom("Test Webhooks Room");
                _existingRoomId = existingRoom.Id;
            }
            catch (Exception)
            {
                var room = _client.CreateRoom("Test Webhooks Room");
                _existingRoomId = room.Id;
            }
        }
Exemplo n.º 9
0
        public static void SendNotification(string roomName, string message, RoomColors color)
        {
retry:
            try
            {
                _hipchat.SendNotification(roomName, message, color);
            }
            catch (HipchatWebException e)
            {
                if (e.Message.Contains("Room not found"))
                {
                    _hipchat.CreateRoom(roomName, false, null, RoomPrivacy.Private);
                }
                if (e.Message.Contains("rate"))
                {
                    return;
                }
                goto retry;
            }
            catch (Exception e)
            {
                LogTo.Error("Hipchat error: {0}- {1}\r\n{2}", e.GetType().ToString(), e.Message, e.StackTrace);
            }
        }
Exemplo n.º 10
0
 public SendRoomNotification()
 {
     HipchatApiConfig.AuthToken = TestsConfig.AuthToken;
     _client         = new HipchatClient();
     _existingRoomId = _client.CreateRoom("Send Notification Test Room").Id;
 }