/// <summary> /// Initializes a new instance of the <see cref="DossierCommands"/> class. /// </summary> /// <param name="database">A database context from the context pool.</param> /// <param name="feedback">The feedback service.</param> /// <param name="content">The content service.</param> /// <param name="dossiers">The dossier service.</param> public DossierCommands(GlobalInfoContext database, UserFeedbackService feedback, ContentService content, DossierService dossiers) { this.Database = database; this.Feedback = feedback; this.Content = content; this.Dossiers = dossiers; }
public void ShouldCreateRatingWithError() { Rating expectedRating = new Rating { RatingValue = 5, Skip = false, }; DBResult <Rating> insertResult = new DBResult <Rating> { Payload = expectedRating, Status = DBStatusCode.Error }; Mock <IRatingDelegate> ratingDelegateMock = new Mock <IRatingDelegate>(); ratingDelegateMock.Setup(s => s.InsertRating(It.Is <Rating>(r => r.RatingValue == expectedRating.RatingValue && r.Skip == expectedRating.Skip))).Returns(insertResult); IUserFeedbackService service = new UserFeedbackService( new Mock <ILogger <UserFeedbackService> >().Object, null, ratingDelegateMock.Object ); RequestResult <Rating> actualResult = service.CreateRating(expectedRating); Assert.Equal(Common.Constants.ResultType.Error, actualResult.ResultStatus); }
public void ShouldCreateUserFeedback() { UserFeedback expectedUserFeedback = new UserFeedback { Comment = "Mocked Comment", Id = Guid.NewGuid(), UserProfileId = "Mocked UserProfileId", IsSatisfied = true, IsReviewed = true }; DBResult <UserFeedback> insertResult = new DBResult <UserFeedback> { Payload = expectedUserFeedback, Status = DBStatusCode.Created }; Mock <IFeedbackDelegate> userFeedbackDelegateMock = new Mock <IFeedbackDelegate>(); userFeedbackDelegateMock.Setup(s => s.InsertUserFeedback(It.Is <UserFeedback>(r => r.Comment == expectedUserFeedback.Comment && r.Id == expectedUserFeedback.Id && r.UserProfileId == expectedUserFeedback.UserProfileId && r.IsSatisfied == expectedUserFeedback.IsSatisfied && r.IsReviewed == expectedUserFeedback.IsReviewed))).Returns(insertResult); IUserFeedbackService service = new UserFeedbackService( new Mock <ILogger <UserFeedbackService> >().Object, userFeedbackDelegateMock.Object, null ); DBResult <UserFeedback> actualResult = service.CreateUserFeedback(expectedUserFeedback); Assert.Equal(DBStatusCode.Created, actualResult.Status); Assert.True(actualResult.Payload.IsDeepEqual(expectedUserFeedback)); }
/// <summary> /// Shows the exception dialog that allows the user to choose whether or not to continue. /// If the user chooses not to continue, Environment.Exit(1) is called.</summary> /// <param name="exception">Exception raised</param> protected override void ShowExceptionDialog(Exception exception) { bool?result = null; try { var dlg = new UnhandledExceptionDialog(); // Call ToString() to get the call stack. The Message property may not include that. dlg.DataContext = new UnhandledExceptionViewModel(exception.ToString()); dlg.Owner = Application.Current.MainWindow; result = dlg.ShowDialog(); if (UserFeedbackService != null) { UserFeedbackService.ShowFeedbackForm(); } } finally { if (result.HasValue && !result.Value) { Environment.Exit(1); } } }
public static async Task <IUserMessage> SendPrivateInteractiveMessageAsync ( this InteractiveService @this, [NotNull] SocketCommandContext context, [NotNull] UserFeedbackService feedback, [NotNull] IInteractiveMessage interactiveMessage ) { if (!(await context.User.GetOrCreateDMChannelAsync() is ISocketMessageChannel userChannel)) { throw new InvalidOperationException("Could not create DM channel for target user."); } try { await feedback.SendConfirmationAsync(context, "Loading..."); } catch (HttpException hex) when(hex.WasCausedByDMsNotAccepted()) { await feedback.SendWarningAsync(context, "You don't accept DMs from non-friends on this server, so I'm unable to do that."); throw new InvalidOperationException("User does not accept DMs from non-friends."); } finally { await((IDMChannel)userChannel).CloseAsync(); } if (!context.IsPrivate) { await feedback.SendConfirmationAsync(context, "Please check your private messages."); } return(await SendInteractiveMessageAsync(@this, context, interactiveMessage, userChannel)); }
public void SetUp() { _fileServiceMock = new Mock <IFileService>(); _consoleMock = new Mock <IConsole>(); _sut = new UserFeedbackService(_fileServiceMock.Object, _consoleMock.Object); fixture = new Fixture(); }
/// <summary> /// Sends the privacy policy to the given channel. /// </summary> /// <param name="channel">The channel.</param> /// <param name="content">The content service.</param> /// <param name="feedback">The feedback service.</param> /// <returns>A task that must be awaited.</returns> public async Task SendPrivacyPolicyAsync ( [NotNull] IMessageChannel channel, [NotNull] ContentService content, UserFeedbackService feedback ) { var result = content.OpenLocalStream(Path.Combine(content.BaseContentPath, "PrivacyPolicy.pdf")); if (!result.IsSuccess) { var errorBuilder = feedback.CreateEmbedBase(Color.Red); errorBuilder.WithDescription ( "Oops. Something went wrong, and I couldn't grab the privacy policy. Please report this to the " + "developer, don't agree to anything, and read it online instead." ); errorBuilder.AddField("Privacy Policy", content.PrivacyPolicyUri); await channel.SendMessageAsync(string.Empty, embed : errorBuilder.Build()); } using (var privacyPolicy = result.Entity) { await channel.SendFileAsync(privacyPolicy, "PrivacyPolicy.pdf"); } }
/// <summary> /// Initializes a new instance of the <see cref="MiscellaneousCommands"/> class. /// </summary> /// <param name="commands">The command service.</param> /// <param name="content">The content service.</param> /// <param name="feedback">The user feedback service.</param> /// <param name="services">The service provider.</param> public MiscellaneousCommands(CommandService commands, ContentService content, UserFeedbackService feedback, IServiceProvider services) { this.Commands = commands; this.Content = content; this.Feedback = feedback; this.Services = services; }
/// <summary> /// Initializes a new instance of the <see cref="SetCommands"/> class. /// </summary> /// <param name="roleplays">The roleplay service.</param> /// <param name="feedback">The user feedback service.</param> public SetCommands ( RoleplayService roleplays, UserFeedbackService feedback) { _roleplays = roleplays; _feedback = feedback; }
/// <summary> /// Initializes a new instance of the <see cref="WarningSetCommands"/> class. /// </summary> /// <param name="warnings">The moderation service.</param> /// <param name="feedback">The feedback service.</param> public WarningSetCommands ( WarningService warnings, UserFeedbackService feedback ) { _warnings = warnings; _feedback = feedback; }
/// <summary> /// Initializes a new instance of the <see cref="ModerationServerCommands"/> class. /// </summary> /// <param name="moderation">The moderation service.</param> /// <param name="feedback">The feedback service.</param> public ModerationServerCommands ( [NotNull] ModerationService moderation, [NotNull] UserFeedbackService feedback ) { _moderation = moderation; _feedback = feedback; }
/// <summary> /// Initializes a new instance of the <see cref="BanSetCommands"/> class. /// </summary> /// <param name="bans">The moderation service.</param> /// <param name="feedback">The feedback service.</param> public BanSetCommands ( BanService bans, UserFeedbackService feedback ) { _bans = bans; _feedback = feedback; }
/// <summary> /// Initializes a new instance of the <see cref="RoleCommands"/> class. /// </summary> /// <param name="feedbackService">The feedback service.</param> /// <param name="characterRoles">The character service.</param> public RoleCommands ( UserFeedbackService feedbackService, CharacterRoleService characterRoles ) { _feedback = feedbackService; _characterRoles = characterRoles; }
/// <summary> /// Initializes a new instance of the <see cref="WarningSetCommands"/> class. /// </summary> /// <param name="warnings">The moderation service.</param> /// <param name="feedback">The feedback service.</param> public WarningSetCommands ( [NotNull] WarningService warnings, [NotNull] UserFeedbackService feedback ) { _warnings = warnings; _feedback = feedback; }
/// <summary> /// Initializes a new instance of the <see cref="NoteSetCommands"/> class. /// </summary> /// <param name="notes">The moderation service.</param> /// <param name="feedback">The feedback service.</param> public NoteSetCommands ( NoteService notes, UserFeedbackService feedback ) { _notes = notes; _feedback = feedback; }
/// <summary> /// Initializes a new instance of the <see cref="NoteSetCommands"/> class. /// </summary> /// <param name="notes">The moderation service.</param> /// <param name="feedback">The feedback service.</param> public NoteSetCommands ( [NotNull] NoteService notes, [NotNull] UserFeedbackService feedback ) { _notes = notes; _feedback = feedback; }
/// <summary> /// Initializes a new instance of the <see cref="PaginatedEmbed"/> class. /// </summary> /// <param name="feedbackService">The feedback service.</param> /// <param name="interactivityService">The interactivity service.</param> /// <param name="sourceUser">The user who caused the interactive message to be created.</param> public PaginatedEmbed ( UserFeedbackService feedbackService, InteractivityService interactivityService, IUser sourceUser ) : base(feedbackService, interactivityService, sourceUser) { }
/// <summary> /// Initializes a new instance of the <see cref="ModerationServerCommands"/> class. /// </summary> /// <param name="moderation">The moderation service.</param> /// <param name="feedback">The feedback service.</param> public ModerationServerCommands ( ModerationService moderation, UserFeedbackService feedback ) { _moderation = moderation; _feedback = feedback; }
/// <summary> /// Initializes a new instance of the <see cref="BanSetCommands"/> class. /// </summary> /// <param name="bans">The moderation service.</param> /// <param name="feedback">The feedback service.</param> public BanSetCommands ( [NotNull] BanService bans, [NotNull] UserFeedbackService feedback ) { _bans = bans; _feedback = feedback; }
/// <summary> /// Initializes a new instance of the <see cref="RoleplayServerCommands"/> class. /// </summary> /// <param name="feedback">The user feedback service.</param> /// <param name="roleplaying">The roleplaying service.</param> /// <param name="servers">The server service.</param> public RoleplayServerCommands ( UserFeedbackService feedback, RoleplayService roleplaying, ServerService servers) { _feedback = feedback; _roleplaying = roleplaying; _servers = servers; }
/// <summary> /// Initializes a new instance of the <see cref="PaginatedMessage{T1,T2}"/> class. /// </summary> /// <param name="feedbackService">The user feedback service.</param> /// <param name="sourceUser">The user who caused the interactive message to be created.</param> protected PaginatedMessage ( UserFeedbackService feedbackService, IUser sourceUser ) : base(sourceUser) { this.Feedback = feedbackService; this.Appearance.Color = Color.DarkPurple; }
/// <summary> /// Initializes a new instance of the <see cref="RoleplayServerCommands"/> class. /// </summary> /// <param name="feedback">The user feedback service.</param> /// <param name="serverSettings">The roleplaying server settings service.</param> /// <param name="servers">The server service.</param> public RoleplayServerCommands ( UserFeedbackService feedback, RoleplayServerSettingsService serverSettings, ServerService servers) { _feedback = feedback; _serverSettings = serverSettings; _servers = servers; }
public TransferStashWorker(TransferStashService2 transferStashService, UserFeedbackService feedbackService) { _transferStashService = transferStashService; _feedbackService = feedbackService; _bw.DoWork += new DoWorkEventHandler(bw_DoWork); _bw.WorkerSupportsCancellation = true; _bw.WorkerReportsProgress = true; _bw.RunWorkerAsync(); }
public CsvParsingService(IPlayerItemDao playerItemDao, IReplicaItemDao replicaItemDao, UserFeedbackService userFeedbackService, TransferStashServiceCache cache, ItemTransferController itemTransferController, TransferStashService transferStashService, SettingsService settings) { _playerItemDao = playerItemDao; _replicaItemDao = replicaItemDao; _userFeedbackService = userFeedbackService; _cache = cache; _itemTransferController = itemTransferController; _transferStashService = transferStashService; _settings = settings; }
/// <summary> /// Initializes a new instance of the <see cref="DossierCommands"/> class. /// </summary> /// <param name="feedback">The feedback service.</param> /// <param name="dossiers">The dossier service.</param> /// <param name="interactivity">The interactivity service.</param> public DossierCommands ( UserFeedbackService feedback, DossierService dossiers, InteractivityService interactivity ) { _feedback = feedback; _dossiers = dossiers; _interactivity = interactivity; }
/// <summary> /// Initializes a new instance of the <see cref="JoinMessageBehaviour"/> class. /// </summary> /// <param name="client">The discord client.</param> /// <param name="feedback">The feedback service.</param> /// <param name="servers">The server service.</param> public JoinMessageBehaviour ( DiscordSocketClient client, UserFeedbackService feedback, ServerService servers ) : base(client) { _feedback = feedback; _servers = servers; }
/// <summary> /// Initializes a new instance of the <see cref="RoleplayArchivalBehaviour"/> class. /// </summary> /// <param name="client">The Discord client.</param> /// <param name="serviceScope">The service scope in use.</param> /// <param name="logger">The logging instance for this type.</param> /// <param name="feedback">The feedback service.</param> public RoleplayArchivalBehaviour ( DiscordSocketClient client, IServiceScope serviceScope, ILogger <RoleplayArchivalBehaviour> logger, UserFeedbackService feedback ) : base(client, serviceScope, logger) { _feedback = feedback; }
/// <summary> /// Initializes a new instance of the <see cref="ReactiveAutoroleUpdateBehaviour"/> class. /// </summary> /// <param name="client">The Discord client.</param> /// <param name="serviceScope">The top-level scope of the behaviour.</param> /// <param name="logger">The service's logging instance.</param> /// <param name="feedback">The user feedback service.</param> public ReactiveAutoroleUpdateBehaviour ( DiscordSocketClient client, IServiceScope serviceScope, ILogger <ReactiveAutoroleUpdateBehaviour> logger, UserFeedbackService feedback ) : base(client, serviceScope, logger) { _feedback = feedback; }
/// <summary> /// Initializes a new instance of the <see cref="JoinMessageBehaviour"/> class. /// </summary> /// <param name="client">The discord client.</param> /// <param name="serviceScope">The service scope in use.</param> /// <param name="logger">The logging instance for this type.</param> /// <param name="feedback">The feedback service.</param> public JoinMessageBehaviour ( DiscordSocketClient client, IServiceScope serviceScope, ILogger <JoinMessageBehaviour> logger, UserFeedbackService feedback ) : base(client, serviceScope, logger) { _feedback = feedback; }
/// <summary> /// Initializes a new instance of the <see cref="KinkCommands"/> class. /// </summary> /// <param name="kinks">The application's kink service.</param> /// <param name="feedback">The application's feedback service.</param> /// <param name="interactivity">The interactivity service.</param> public KinkCommands ( KinkService kinks, UserFeedbackService feedback, InteractivityService interactivity ) { _kinks = kinks; _feedback = feedback; _interactivity = interactivity; }