public ClickServiceTests()
        {
            _clickRepository = new Mock <IClickRepository>(MockBehavior.Strict);
            _linkService     = new Mock <ILinkService>(MockBehavior.Strict);

            _clickService = new ClickService(_linkService.Object, _clickRepository.Object);
        }
示例#2
0
 public HomeController(
     IClickService clickService,
     IClickStorage storage
     )
 {
     _clickService = clickService;
     _storage      = storage;
 }
        public MainPageViewModel(IClickService clickService)
        {
            this._clickService = clickService;

            this._model = new MainPageModel()
                {
                    First = "first",
                    Second = "second"
                };
        }
示例#4
0
        public Mutations(ILinkService linkService, IClickService clickService)
        {
            Name        = "Mutation";
            Description = "This is where the mutations are.";

            Field <LinkInfoType>("createLink",
                                 arguments: new QueryArguments(
                                     new QueryArgument <StringGraphType> {
                Name = "url", Description = "The URL of the link."
            }
                                     ),
                                 description: "Create a new link", resolve: context =>
            {
                var url    = context.GetArgument <string>("url");
                var result = linkService.CreateLink(url);
                if (!string.IsNullOrEmpty(result.ErrorMessage))
                {
                    context.Errors.Add(new ExecutionError(result.ErrorMessage));
                    return(null);
                }
                return(result.Data);
            });

            Field <LinkType>("trackClick",
                             arguments: new QueryArguments(
                                 new QueryArgument <StringGraphType> {
                Name = "shortcut", Description = "The shortcut of the link."
            }
                                 ),
                             description: "Track new click of a link", resolve: context =>
            {
                var shortcut = context.GetArgument <string>("shortcut");
                var result   = clickService.TrackClick(shortcut);
                if (!string.IsNullOrEmpty(result.ErrorMessage))
                {
                    context.Errors.Add(new ExecutionError(result.ErrorMessage));
                    return(null);
                }
                return(result.Data);
            });
        }
示例#5
0
 public ClicksController(IClickService linkService) => _clickService = linkService;
 public GraphQLController(ILinkService linkService, IClickService clickService)
 {
     _linkService  = linkService;
     _clickService = clickService;
 }