示例#1
0
        /// <summary>
        ///     Creates the room.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="description">The description.</param>
        /// <returns>Task&lt;ITeamRoom&gt;.</returns>
        public async Task <ITeamRoom> CreateRoom(string name, string description)
        {
            const string format   = " \"name\": \"{0}\", \"description\": \"{1}\", ";
            string       body     = "{" + String.Format(format, name, description) + "}";
            var          exchange = StructuredHttpExchange.Post("/chat/rooms", body);
            ITeamRoom    result   = await ProcessCollectionRequest(exchange, o => JsonParsers.JObjectToInstance(o, TeamRoomImpl.FromToken));

            return(result);
        }
        public void CreateTeamRoom_UnitTest()
        {
            var api = new TeamRoomAPI();

            string           name        = String.Format("Test Room {0}", DateTime.UtcNow.Ticks);
            const string     description = "Dummy Room Created by Unit Test";
            Task <ITeamRoom> loadTask    = api.CreateRoom(name, description);
            ITeamRoom        teamRoom    = loadTask.Result;

            Assert.IsNotNull(teamRoom);
        }