Exemple #1
0
        /// <summary>
        /// This is called on F5 to return the list of debug targets. What is returned depends on the debug provider extensions
        /// which understands how to launch the currently active profile type.
        /// </summary>
        private async Task <IReadOnlyList <IDebugLaunchSettings> > QueryDebugTargetsInternalAsync(DebugLaunchOptions launchOptions, bool fromDebugLaunch)
        {
            // Get the active debug profile (timeout of 5s, though in reality is should never take this long as even in error conditions
            // a snapshot is produced).
            ILaunchSettings currentProfiles = await LaunchSettingsProvider.WaitForFirstSnapshot(5000);

            ILaunchProfile activeProfile = currentProfiles?.ActiveProfile;

            // Should have a profile
            if (activeProfile == null)
            {
                throw new Exception(VSResources.ActiveLaunchProfileNotFound);
            }

            // Now find the DebugTargets provider for this profile
            IDebugProfileLaunchTargetsProvider launchProvider = GetLaunchTargetsProvider(activeProfile) ??
                                                                throw new Exception(string.Format(VSResources.DontKnowHowToRunProfile, activeProfile.Name));

            IReadOnlyList <IDebugLaunchSettings> launchSettings;

            if (fromDebugLaunch && launchProvider is IDebugProfileLaunchTargetsProvider2 launchProvider2)
            {
                launchSettings = await launchProvider2.QueryDebugTargetsForDebugLaunchAsync(launchOptions, activeProfile);
            }
            else
            {
                launchSettings = await launchProvider.QueryDebugTargetsAsync(launchOptions, activeProfile);
            }

            LastLaunchProvider = launchProvider;
            return(launchSettings);
        }
Exemple #2
0
        public async Task ShouldGetAllOrderReturnAddresses()
        {
            var env     = LaunchSettingsProvider.GetEnvironmentalVariables();
            var client  = OrderApiClientFactory.Create();
            var request = new OrderDeliveryNote
            {
                AddressId        = env["CDON_RETURN_ADDRESS_ID"],
                OrderId          = int.Parse(env["GETORDER_ORDERID"]),
                DeliveryNoteRows = new[]
                {
                    new OrderDeliveryNoteRow
                    {
                        ProductId       = "test_sku",
                        ProductName     = "test_name",
                        Quantity        = 1,
                        PickingLocation = "test_picking_location",
                    }
                }
            };
            var stream = await client.GetDeliveryNote(request);

            var base64 = StreamToBase64(stream);

            Assert.True(base64.Length > 30_000);
        }
Exemple #3
0
        public static ProductApiClient Create()
        {
            var environmentalVariables = LaunchSettingsProvider.GetEnvironmentalVariables();
            var uri    = environmentalVariables["CDON_PRODUCT_API_URI"];
            var apiKey = environmentalVariables["CDON_API_KEY"];

            return(new ProductApiClient(uri, apiKey));
        }
Exemple #4
0
        public static IOrderApiClient Create()
        {
            var environmentalVariables = LaunchSettingsProvider.GetEnvironmentalVariables();
            var uri    = environmentalVariables["CDON_MARKETPLACE_URI"];
            var apiKey = environmentalVariables["CDON_API_KEY"];

            return(new OrderApiClient(uri, apiKey));
        }
Exemple #5
0
        public async Task ShouldGetOrder()
        {
            var orderId = LaunchSettingsProvider.GetEnvironmentalVariables()["GETORDER_ORDERID"];
            var client  = OrderApiClientFactory.Create();
            var order   = await client.GetOrder(Convert.ToInt32(orderId));

            Assert.NotNull(order);
        }
        /// <summary>
        /// This is called on F5 to return the list of debug targets.What we return depends on the type
        /// of project.
        /// </summary>
        public override async Task <IReadOnlyList <IDebugLaunchSettings> > QueryDebugTargetsAsync(DebugLaunchOptions launchOptions)
        {
            // Get the active debug profile (timeout of 5s, though in reality is should never take this long as even in error conditions
            // a snapshot is produced).
            var currentProfiles = await LaunchSettingsProvider.WaitForFirstSnapshot(5000).ConfigureAwait(true);

            ILaunchProfile activeProfile = currentProfiles?.ActiveProfile;

            // Should have a profile
            if (activeProfile == null)
            {
                throw new Exception(VSResources.ActiveLaunchProfileNotFound);
            }

            // Now find the DebugTargets provider for this profile
            var launchProvider = GetLaunchTargetsProvider(activeProfile) ??
                                 throw new Exception(string.Format(VSResources.DontKnowHowToRunProfile, activeProfile.Name));

            var launchSettings = await launchProvider.QueryDebugTargetsAsync(launchOptions, activeProfile).ConfigureAwait(true);

            LastLaunchProvider = launchProvider;
            return(launchSettings);
        }