示例#1
0
 /// <summary>
 /// Get a list of all messages in a chat
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='chatId'>
 /// The id of the message to get
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <GetMessageDTO> > GetMessagesInChatAsync(this IChats operations, int chatId, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetMessagesInChatWithHttpMessagesAsync(chatId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
示例#2
0
 /// <summary>
 /// Create a new chat with only the caller as a member
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='chatName'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ChatDTO> CreateChatAsync(this IChats operations, string chatName, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateChatWithHttpMessagesAsync(chatName, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
示例#3
0
 /// <summary>
 /// Get alle chats for the user
 /// </summary>
 /// <remarks>
 /// Gets all chats for the specific user id
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='userId'>
 /// The id of the user
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <ChatDTO> > GetAllChatsForUserAsync(this IChats operations, int userId, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetAllChatsForUserWithHttpMessagesAsync(userId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
        public void SetUp()
        {
            skype = MockRepository.GenerateMock<ISkype>();
            chat = MockRepository.GenerateMock<IChat>();
            userCollection = MockRepository.GenerateMock<IUserCollection>();
            client = MockRepository.GenerateMock<IClient>();
            user = MockRepository.GenerateMock<IUser>();
            configurationLoader = new ConfigurationLoader();
            httpGet = MockRepository.GenerateMock<IHttpGet>();
            chats = MockRepository.GenerateMock<IChats>();
            messengerClient = new MessengerClient(skype, userCollection, chats);

            buildCollection = MockRepository.GenerateMock<IBuildCollection>();
            loader = new Loader(messengerClient, buildCollection);
            stopper = MockRepository.GenerateMock<IStopper>();
            controller = new Controller();
            controller.Container.Kernel.AddComponentInstance<ISkype>(skype);
            controller.Container.Kernel.AddComponentInstance<IUserCollection>(userCollection);
            controller.Container.Kernel.AddComponentInstance<IStopper>(stopper);
            controller.CcTrayUrl = "http://localhost/Cctray.xml";
            controller.CcTrayUsername = "******";
            controller.CcTrayPassword = "******";
            controller.HttpTimeout = 30;
            controller.Configuration = @"RealUsers.xml";
        }
示例#5
0
 public void SetUp()
 {
     _skype = MockRepository.GenerateMock<ISkype>();
     _userCollection = MockRepository.GenerateMock<IUserCollection>();
     _chats = MockRepository.GenerateMock<IChats>();
     _messengerClient = new MessengerClient(_skype, _userCollection,_chats);
     _skypeClient = MockRepository.GenerateMock<IClient>();
 }
示例#6
0
 public void SetUp()
 {
     skype = MockRepository.GenerateMock<ISkype>();
     chat = MockRepository.GenerateMock<IChat>();
     userCollection = MockRepository.GenerateMock<IUserCollection>();
     client = MockRepository.GenerateMock<IClient>();
     chats = MockRepository.GenerateMock<IChats>();
     messengerClient = new MessengerClient(skype, userCollection, chats);
 }
示例#7
0
 public TaskController(ITasks task, ITaskAttachments taskAttachments, ITaskBids taskBids, ITaskPreWorkers taskPreWorkers, ILog log, ITaskOffers taskOffers, INotifycations notifycations, IChats chats)
 {
     _task            = task;
     _taskAttachments = taskAttachments;
     _taskBids        = taskBids;
     _taskPreWorkers  = taskPreWorkers;
     _log             = log;
     _taskOffers      = taskOffers;
     _notifycations   = notifycations;
     _chats           = chats;
 }
示例#8
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     Users    = new Users(this);
     Groups   = new Groups(this);
     Channels = new Channels(this);
     Messages = new Messages(this);
     Roles    = new Roles(this);
     Chats    = new Chats(this);
     BaseUri  = new System.Uri("https://chatextest.azurewebsites.net/1.0.0");
     //BaseUri = new System.Uri("https://chatextest.azurewebsites.net/1.0.0");
     SerializationSettings = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new  List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
 }
示例#9
0
 /// <summary>
 /// Add users to a chat
 /// </summary>
 /// <remarks>
 /// This will add a list of users to a specific chat
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='addUsersToChatDTO'>
 /// Users to be added to a chat
 /// </param>
 public static void AddUsersToChat(this IChats operations, AddUsersToChatDTO addUsersToChatDTO = default(AddUsersToChatDTO))
 {
     operations.AddUsersToChatAsync(addUsersToChatDTO).GetAwaiter().GetResult();
 }
示例#10
0
 /// <summary>
 /// Get a list of all messages in a chat
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='chatId'>
 /// The id of the message to get
 /// </param>
 public static IList <GetMessageDTO> GetMessagesInChat(this IChats operations, int chatId)
 {
     return(operations.GetMessagesInChatAsync(chatId).GetAwaiter().GetResult());
 }
示例#11
0
 /// <summary>
 /// Create a new chat with only the caller as a member
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='chatName'>
 /// </param>
 public static ChatDTO CreateChat(this IChats operations, string chatName)
 {
     return(operations.CreateChatAsync(chatName).GetAwaiter().GetResult());
 }
示例#12
0
 /// <summary>
 /// Get alle chats for the user
 /// </summary>
 /// <remarks>
 /// Gets all chats for the specific user id
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='userId'>
 /// The id of the user
 /// </param>
 public static IList <ChatDTO> GetAllChatsForUser(this IChats operations, int userId)
 {
     return(operations.GetAllChatsForUserAsync(userId).GetAwaiter().GetResult());
 }
示例#13
0
 /// <summary>
 /// Add users to a chat
 /// </summary>
 /// <remarks>
 /// This will add a list of users to a specific chat
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='addUsersToChatDTO'>
 /// Users to be added to a chat
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task AddUsersToChatAsync(this IChats operations, AddUsersToChatDTO addUsersToChatDTO = default(AddUsersToChatDTO), CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.AddUsersToChatWithHttpMessagesAsync(addUsersToChatDTO, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
示例#14
0
 public MessengerClient(ISkype skype, IUserCollection userCollection, IChats chats)
 {
     _skype = skype;
     _userCollection = userCollection;
     _chats = chats;
 }
示例#15
0
 public ChatController(IChatMessages message, IChats chats)
 {
     _message = message;
     _chats   = chats;
 }