public ClickServiceTests() { _clickRepository = new Mock <IClickRepository>(MockBehavior.Strict); _linkService = new Mock <ILinkService>(MockBehavior.Strict); _clickService = new ClickService(_linkService.Object, _clickRepository.Object); }
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" }; }
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); }); }
public ClicksController(IClickService linkService) => _clickService = linkService;
public GraphQLController(ILinkService linkService, IClickService clickService) { _linkService = linkService; _clickService = clickService; }