Ejemplo n.º 1
0
 public void Setup()
 {
     _dependencies      = new KarassDependencies();
     _frameFactory      = new FrameFactory(_dependencies);
     _mockFramesFactory = new MockFramesFactory(_frameFactory);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new instance of <see cref="Manifest"/>.
 /// </summary>
 /// <param name="dependencies">The host provided dependencies.</param>
 public Manifest(IDependencies dependencies)
 {
     _libraries       = new List <ILibraryInstallationState>();
     _dependencies    = dependencies;
     _hostInteraction = dependencies?.GetHostInteractions();
 }
Ejemplo n.º 3
0
 public ExactTargetClient(IDependencies dependencies)
 {
     _dependencies = dependencies;
 }
Ejemplo n.º 4
0
 public SubscriptionPageController(IDependencies dependencies)
 {
     _dependencies = dependencies;
 }
Ejemplo n.º 5
0
 public EmailDCDController(IDependencies dependencies)
 {
     _ = dependencies;
 }
Ejemplo n.º 6
0
 public KarassFrameDummy(IDependencies dependencies) : base(dependencies)
 {
 }
 public ServiceBusWaitAndCheckTests()
 {
     _d = GetService <IDependencies <Test> >();
 }
Ejemplo n.º 8
0
//        private readonly TelemetryClient telemetry;

        public ApiRequestHandler(IDependencies dependencies)
        {
            this.Session  = dependencies.Session;
            this.Mediator = dependencies.Mediator;
            //          this.telemetry = dependencies.TelemetryClient;
        }
        protected override IEnumerable <JsonCompletionEntry> GetEntries(JsonCompletionContext context)
        {
            var member = context.ContextNode as MemberNode;

            if (member == null || member.UnquotedNameText != ManifestConstants.Library)
            {
                yield break;
            }

            var parent = member.Parent as ObjectNode;

            if (!JsonHelpers.TryGetInstallationState(parent, out ILibraryInstallationState state))
            {
                yield break;
            }

            IDependencies   dependencies = _dependenciesFactory.FromConfigFile(ConfigFilePath);
            IProvider       provider     = dependencies.GetProvider(state.ProviderId);
            ILibraryCatalog catalog      = provider?.GetCatalog();

            if (catalog == null)
            {
                yield break;
            }

            // member.Value is null when there is no value yet, e.g. when typing a space at "library":|
            // where | represents caret position. In this case, set caretPosition to "1" to short circuit execution of this function
            // and return no entries (member.UnquotedValueText will be empty string in that case).
            int caretPosition = member.Value != null ? context.Session.TextView.Caret.Position.BufferPosition - member.Value.Start - 1 : 1;

            if (caretPosition > member.UnquotedValueText.Length)
            {
                yield break;
            }

            Task <CompletionSet> task = catalog.GetLibraryCompletionSetAsync(member.UnquotedValueText, caretPosition);
            int count = 0;

            if (!context.Session.Properties.ContainsProperty(CompletionController.RetriggerCompletion))
            {
                context.Session.Properties.AddProperty(CompletionController.RetriggerCompletion, true);
            }

            if (task.IsCompleted)
            {
                CompletionSet completionSet = task.Result;

                if (completionSet.Completions != null)
                {
                    List <JsonCompletionEntry> results = GetCompletionList(member, context, completionSet, count);

                    foreach (JsonCompletionEntry completionEntry in results)
                    {
                        yield return(completionEntry);
                    }
                }
            }
            else
            {
                yield return(new SimpleCompletionEntry(Resources.Text.Loading, string.Empty, KnownMonikers.Loading, context.Session));

                _ = task.ContinueWith((t) =>
                {
                    if (!t.IsCanceled || !t.IsFaulted)
                    {
                        if (!context.Session.IsDismissed)
                        {
                            CompletionSet completionSet = t.Result;

                            if (completionSet.Completions != null)
                            {
                                List <JsonCompletionEntry> results = GetCompletionList(member, context, completionSet, count);

                                UpdateListEntriesSync(context, results);
                            }
                        }
                    }
                }, TaskScheduler.Default);
            }
        }
Ejemplo n.º 10
0
 public SpecialCharacterMapper(IDependencies dependencies)
 {
     _dependencies = dependencies;
 }
Ejemplo n.º 11
0
 public Handler(IDependencies dependencies) : base(dependencies)
 {
 }
Ejemplo n.º 12
0
 public HomeAssistantMasterPageViewModel(IDependencies dependencies)
     : base(dependencies)
 {
 }
 private IDictionary<string, IDependency> ReadDependencies(IDependencies dependencies) {
     return ReadDependencies(dependencies, 16);
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Validates <see cref="ILibraryInstallationState"/>
        /// </summary>
        /// <param name="state">The <see cref="ILibraryInstallationState"/> to validate.</param>
        /// <param name="dependencies">The <see cref="IDependencies"/> used to validate <see cref="ILibraryInstallationState"/></param>
        /// <returns><see cref="ILibraryOperationResult"/> with the result of the validation</returns>
        public static async Task <ILibraryOperationResult> IsValidAsync(this ILibraryInstallationState state, IDependencies dependencies)
        {
            if (state == null)
            {
                return(LibraryOperationResult.FromError(PredefinedErrors.UnknownError()));
            }

            if (string.IsNullOrEmpty(state.ProviderId))
            {
                return(LibraryOperationResult.FromError(PredefinedErrors.ProviderIsUndefined()));
            }

            IProvider provider = dependencies.GetProvider(state.ProviderId);

            if (provider == null)
            {
                return(LibraryOperationResult.FromError(PredefinedErrors.ProviderUnknown(state.ProviderId)));
            }

            return(await IsValidAsync(state, provider).ConfigureAwait(false));
        }
Ejemplo n.º 15
0
 public PxmXmlHelper(IDependencies dependencies)
 {
     _dependencies = dependencies;
 }
        private IDictionary<string, IDependency> ReadDependencies(IDependencies dependencies, int expectedCount) {
            Assert.AreEqual(expectedCount, dependencies.Count, "Dependency count mismatch.");

            var retrieved = new Dictionary<string, IDependency>();
            foreach (var dependency in dependencies) {
                retrieved[dependency.Name] = dependency;
            }
            return retrieved;
        }
Ejemplo n.º 17
0
 public TokenToHtml(IDependencies dependencies)
 {
     _dependencies = dependencies;
 }
Ejemplo n.º 18
0
 public IssuesService(IDependencies dependencies)
 {
     _dependencies = dependencies;
 }
Ejemplo n.º 19
0
 public DealService(IDependencies dependencies)
 {
     _ = dependencies;
 }
Ejemplo n.º 20
0
 public SitecoreUrlWrapper(IDependencies dependencies)
 {
     _dependencies   = dependencies;
     ContextDatabase = Sitecore.Context.ContentDatabase ?? Sitecore.Context.Database;
 }
Ejemplo n.º 21
0
 public EmailAuthorController(IDependencies dependencies)
 {
     _ = dependencies;
 }
Ejemplo n.º 22
0
 public ReleaseInventoryWhenSalesOrderCancelled(IDependencies dependencies) : base(dependencies)
 {
 }
Ejemplo n.º 23
0
 public AddIssueController(IDependencies dependencies)
 {
     _dependencies = dependencies;
 }
Ejemplo n.º 24
0
        /// <summary>
        /// Validates the values of each Library property and returns a collection of ILibraryOperationResult for each of them
        /// </summary>
        /// <param name="libraries"></param>
        /// <param name="dependencies"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        private static async Task <IEnumerable <ILibraryOperationResult> > ValidatePropertiesAsync(IEnumerable <ILibraryInstallationState> libraries, IDependencies dependencies, CancellationToken cancellationToken)
        {
            var validationStatus = new List <ILibraryOperationResult>();

            foreach (ILibraryInstallationState library in libraries)
            {
                cancellationToken.ThrowIfCancellationRequested();

                ILibraryOperationResult result = await library.IsValidAsync(dependencies).ConfigureAwait(false);

                if (!result.Success)
                {
                    validationStatus.Add(result);
                }
                else
                {
                    validationStatus.Add(LibraryOperationResult.FromSuccess(library));
                }
            }

            return(validationStatus);
        }
Ejemplo n.º 25
0
 public AdminMasterPageViewModel(IDependencies dependencies)
     : base(dependencies)
 {
 }
Ejemplo n.º 26
0
 public SimpleKarassFrame(Func <string, bool> method, IDependencies dependencies) : base(dependencies)
 {
     _simpleMethod = method;
 }
Ejemplo n.º 27
0
 public FeaturedArticleViewModel(IDependencies dependencies)
 {
     _dependencies = dependencies;
 }
        protected override IEnumerable <JsonCompletionEntry> GetEntries(JsonCompletionContext context)
        {
            MemberNode member = context.ContextNode.FindType <MemberNode>();

            if (member == null || member.UnquotedNameText != "files")
            {
                yield break;
            }

            var parent = member.Parent as ObjectNode;

            if (!JsonHelpers.TryGetInstallationState(parent, out ILibraryInstallationState state))
            {
                yield break;
            }

            if (string.IsNullOrEmpty(state.Name))
            {
                yield break;
            }

            IDependencies   dependencies = _dependenciesFactory.FromConfigFile(ConfigFilePath);
            IProvider       provider     = dependencies.GetProvider(state.ProviderId);
            ILibraryCatalog catalog      = provider?.GetCatalog();

            if (catalog == null)
            {
                yield break;
            }

            Task <ILibrary>      task      = catalog.GetLibraryAsync(state.Name, state.Version, CancellationToken.None);
            FrameworkElement     presenter = GetPresenter(context);
            IEnumerable <string> usedFiles = GetUsedFiles(context);

            if (task.IsCompleted)
            {
                if (!(task.Result is ILibrary library))
                {
                    yield break;
                }

                foreach (string file in library.Files.Keys)
                {
                    if (!usedFiles.Contains(file))
                    {
                        ImageSource glyph = WpfUtil.GetIconForFile(presenter, file, out bool isThemeIcon);
                        yield return(new SimpleCompletionEntry(file, glyph, context.Session));
                    }
                }
            }
            else
            {
                yield return(new SimpleCompletionEntry(Resources.Text.Loading, string.Empty, KnownMonikers.Loading, context.Session));

                _ = task.ContinueWith(async(t) =>
                {
                    await VisualStudio.Shell.ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                    if (!(t.Result is ILibrary library))
                    {
                        return;
                    }

                    if (!context.Session.IsDismissed)
                    {
                        var results = new List <JsonCompletionEntry>();

                        foreach (string file in library.Files.Keys)
                        {
                            if (!usedFiles.Contains(file))
                            {
                                ImageSource glyph = WpfUtil.GetIconForFile(presenter, file, out bool isThemeIcon);
                                results.Add(new SimpleCompletionEntry(file, glyph, context.Session));
                            }
                        }

                        UpdateListEntriesSync(context, results);
                    }
                }, TaskScheduler.Default);
            }
        }
Ejemplo n.º 29
0
        public HomeController(IDependencies <HomeController> dependencies)
        {
            CheckIsNotNull(nameof(dependencies), dependencies);

            _d = dependencies;
        }
Ejemplo n.º 30
0
 public MockFramesFactory(IFrameFactory frameFactory)
 {
     _frameFactory = frameFactory;
     _dependencies = frameFactory.Dependencies;
 }
 public SavedSearchOptOutViewModel(IDependencies dependencies)
 {
     _dependencies = dependencies;
 }
Ejemplo n.º 32
0
 public KarassFramesStub(List <FrameRequest[]> frames, IDependencies dependencies, IFrameFactory framesFactory) : base(
         new List <List <Action> >(),
         new List <List <Action> >(), frames)
 {
 }
 private void CheckEmptyDependenciesNotNull(IDependencies dependencies) {
     Assert.IsNotNull(dependencies, "Dependencies should not be null.");
     Assert.AreEqual(0, dependencies.Count, "Should not be any dependencies.");
 }