/// <summary>
 ///     Initializes a new instance of the <see cref="SoulseekClientStateChangedEventArgs"/> class.
 /// </summary>
 /// <param name="previousState">The previous state of the client.</param>
 /// <param name="state">The current state of the client.</param>
 /// <param name="message">The message associated with the change in state, if applicable.</param>
 /// <param name="exception">The Exception associated with the change in state, if applicable.</param>
 public SoulseekClientStateChangedEventArgs(SoulseekClientStates previousState, SoulseekClientStates state, string message = null, Exception exception = null)
 {
     PreviousState = previousState;
     State         = state;
     Message       = message;
     Exception     = exception;
 }
Exemple #2
0
        public async Task AddUserAsync_Throws_InvalidOperationException_If_Logged_In(SoulseekClientStates state)
        {
            var s = new SoulseekClient();

            s.SetProperty("State", state);

            var ex = await Record.ExceptionAsync(async() => await s.AddUserAsync("a"));

            Assert.NotNull(ex);
            Assert.IsType <InvalidOperationException>(ex);
        }
        public async Task GetUserInfoAsync_Throws_InvalidOperationException_If_Logged_In(SoulseekClientStates state)
        {
            using (var s = new SoulseekClient())
            {
                s.SetProperty("State", state);

                var ex = await Record.ExceptionAsync(() => s.GetUserInfoAsync("a"));

                Assert.NotNull(ex);
                Assert.IsType <InvalidOperationException>(ex);
            }
        }
Exemple #4
0
        public async Task GrantUserPrivilegesAsync_Throws_InvalidOperationException_If_Not_Connected_And_Logged_In(SoulseekClientStates state)
        {
            using (var s = new SoulseekClient())
            {
                s.SetProperty("State", state);

                var ex = await Record.ExceptionAsync(() => s.GrantUserPrivilegesAsync("a", 1));

                Assert.NotNull(ex);
                Assert.IsType <InvalidOperationException>(ex);
            }
        }
        public void SoulseekClientStateChangedEventArgs_Instantiates_With_The_Given_Data_And_Exception(SoulseekClientStates previousState, SoulseekClientStates state, string message, Exception ex)
        {
            var s = new SoulseekClientStateChangedEventArgs(previousState, state, message, ex);

            Assert.Equal(previousState, s.PreviousState);
            Assert.Equal(state, s.State);
            Assert.Equal(message, s.Message);
            Assert.Equal(ex, s.Exception);
        }
Exemple #6
0
        public async Task ChangePasswordAsync_Throws_InvalidOperationException_If_Not_Logged_In(SoulseekClientStates state)
        {
            using (var s = new SoulseekClient())
            {
                s.SetProperty("State", state);

                var ex = await Record.ExceptionAsync(async() => await s.ChangePasswordAsync("a"));

                Assert.NotNull(ex);
                Assert.IsType <InvalidOperationException>(ex);
            }
        }
Exemple #7
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="SoulseekClientStateChangedEventArgs"/> class.
 /// </summary>
 /// <param name="previousState">The previous state of the client.</param>
 /// <param name="state">The current state of the client.</param>
 /// <param name="message">The message associated with the change in state, if applicable.</param>
 internal SoulseekClientStateChangedEventArgs(SoulseekClientStates previousState, SoulseekClientStates state, string message = null)
 {
     PreviousState = previousState;
     State         = state;
     Message       = message;
 }
Exemple #8
0
        public async Task GetPeerInfoAsync_Throws_InvalidOperationException_If_Logged_In(SoulseekClientStates state)
        {
            var s = new SoulseekClient();

            s.SetProperty("State", state);

            var ex = await Record.ExceptionAsync(async() => await s.GetDownloadPlaceInQueueAsync("a", "b"));

            Assert.NotNull(ex);
            Assert.IsType <InvalidOperationException>(ex);
        }