예제 #1
0
        public async Task ExecuteOperationAsync_UnexpectedExceptionIsWrappedInFatalClientException()
        {
            var mockPipeline = new Mock <IPipeline>(MockBehavior.Strict);

            // some unexpected exception
            var innerException = new UnauthorizedAccessException();

            mockPipeline
            .Setup(h => h.ProcessAsync(
                       It.IsAny <PipelineContext <BasicTestEntity> >(),
                       It.IsAny <ILogger>(),
                       It.IsAny <CancellationToken>()))
            .Callback((PipelineContext <BasicTestEntity> context, ILogger log, CancellationToken cancellationToken) => {
                throw innerException;
            })
            .Returns(Task.CompletedTask);

            this.mockPipelineFactory
            .Setup(h => h.GetPipeline(
                       It.IsAny <PipelineContext <BasicTestEntity> >()))
            .Returns(mockPipeline.Object);

            var getContext = new GetContext <BasicTestEntity>(EndpointName.Tests, null);

            try
            {
                await this.apiService.ExecuteOperationAsync(getContext, default).ConfigureAwait(false);

                Assert.Fail($"Expected {nameof(FatalClientException)} to be thrown.");
            }
            catch (FatalClientException e)
            {
                Assert.IsInstanceOfType(e.InnerException, innerException.GetType());
            }
        }
예제 #2
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            LogViewHolder logViewHolder = holder as LogViewHolder;

            lock (LogsContext.DbLocker)
            {
                using (LogsContext db = new LogsContext())
                {
                    LogRowModel row = GetContext.OrderByDescending(x => x.CreatedAt).Skip(position).FirstOrDefault();
                    logViewHolder.LogMessageTextMessage.Text   = row.Name;
                    logViewHolder.LogMessageDateTimeStamp.Text = row.CreatedAt.ToString("dd MMM HH:mm:ss");
                    logViewHolder.LogMessageStatus.Text        = row.Status.ToString().Substring(0, 1);
                    switch (row.Status)
                    {
                    case LogStatusesEnum.Error:
                        logViewHolder.LogMessageStatus.SetTextColor(Color.Red);
                        break;

                    case LogStatusesEnum.Warn:
                        logViewHolder.LogMessageStatus.SetTextColor(Color.Orange);
                        break;

                    case LogStatusesEnum.Info:
                        logViewHolder.LogMessageStatus.SetTextColor(Color.SeaGreen);
                        break;

                    case LogStatusesEnum.Trac:
                        logViewHolder.LogMessageStatus.SetTextColor(Color.Gray);
                        break;
                    }
                    logViewHolder.LogMessageTag.Text = row.TAG.ToString();
                }
            }
        }
        public override void Draw(StandardFrameData frameData)
        {
            // Clear
            DepthStencilView depthStencilView = RenderBackend.DisplayRef.DepthStencilViewRef;
            RenderTargetView renderTargetView = RenderBackend.DisplayRef.RenderTargetViewRef;

            GetContext.ClearRenderTargetView(renderTargetView, Color.Gray);
            GetContext.ClearRenderTargetView(hdrRenderTargetView, Color.Gray);
            GetContext.ClearDepthStencilView(
                depthStencilView,
                DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil,
                0.0f, 0
                );

            if (isWireframe)
            {
                WireframePass(frameData, depthStencilView, renderTargetView);
                return;
            }
            //DepthPrePassWithVelocity(frameData, depthStencilView);
            DepthPrePass(frameData, depthStencilView, renderTargetView);
            // TODO: shadow maps draw pass
            ColourPass(frameData, depthStencilView, renderTargetView);
            ScreenQuadPass(frameData, depthStencilView, renderTargetView);
        }
예제 #4
0
        public async Task AutoPagingPipelineTests_CorrectlyHandlesMultiplePagesAsync()
        {
            var getContext = new GetContext <BasicTestEntity>(EndpointName.Tests, null, null);

            this.mockInnerPipeline
            .Setup(h => h.ProcessAsync(
                       It.IsAny <PipelineContext <BasicTestEntity> >(),
                       It.IsAny <ILogger>(),
                       It.IsAny <CancellationToken>()))
            .Callback((PipelineContext <BasicTestEntity> context, ILogger log, CancellationToken cancellationToken) => MockHandleTwoPages(context))
            .Returns(Task.CompletedTask);

            this.pipeline.InnerPipeline = this.mockInnerPipeline.Object;

            await this.pipeline.ProcessAsync(getContext, NullLogger.Instance, default).ConfigureAwait(false);

            // inner pipeline should have been called twice
            const int expectedCount = 2;

            Assert.AreEqual(expectedCount, this.mockInnerPipeline.Invocations.Count,
                            $"Expected the inner pipeline to have been called {expectedCount} times.");

            Assert.AreEqual(expectedCount, getContext.Results.Items.Count,
                            $"Expected {expectedCount} result items.");

            Assert.IsFalse(getContext.ResultsMeta.More, "Expected no more pages.");

            Assert.AreEqual(expectedCount, getContext.Options.Page,
                            $"Expected final page request to be for page {expectedCount}.");
        }
예제 #5
0
        public async Task Pipeline_ThrowsWhenCancellationIsRequested()
        {
            var context          = new GetContext <TestEntity>(EndpointName.Tests, filter: null, options: null);
            var pipelineElement1 = new Mock <IPipelineElement>(MockBehavior.Strict);
            var pipelineElement2 = new Mock <IPipelineElement>(MockBehavior.Strict);

            var tokenSource = new CancellationTokenSource();

            // setup the pipeline element to cancel during operation
            pipelineElement1.Setup(h => h.ProcessAsync(
                                       It.IsAny <PipelineContext <TestEntity> >(),
                                       It.IsAny <ILogger>(),
                                       It.IsAny <CancellationToken>()))
            .Callback((PipelineContext <TestEntity> c, ILogger l, CancellationToken ct) => tokenSource.Cancel())
            .Returns(Task.CompletedTask);

            this.requestPipeline.AddStage(pipelineElement1.Object, pipelineElement2.Object);

            try
            {
                await this.requestPipeline.ProcessAsync(context, NullLogger.Instance, tokenSource.Token).ConfigureAwait(false);

                Assert.Fail($"Expected {nameof(OperationCanceledException)} to be thrown.");
            }
            catch (OperationCanceledException) { }
        }
예제 #6
0
 public NLogger(Type type, GetContext preSetTags = null)
 {
     logger = LogManager.GetLogger(type.FullName);
     this.type = type;
     this.preSetTags = preSetTags;
     this.info = GetLoggingInfo(type);
 }
예제 #7
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseIpRateLimiting();

            app.UseStaticFiles();
            lifetime.ApplicationStarted.Register(UnRegService);
            GetContext.getInstance().ServiceProvider = app.ApplicationServices;
            getService();
            app.UseRouting();
            app.UseAuthorization();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
        }
예제 #8
0
        public async Task AutoPagingPipelineTests_ThrowsWhenCancellationIsRequested()
        {
            var getContext = new GetContext <BasicTestEntity>(EndpointName.Tests, null, null);

            var tokenSource = new CancellationTokenSource();

            // setup the inner pipeline element to cancel during retrieval of the first page
            this.mockInnerPipeline
            .Setup(h => h.ProcessAsync(
                       It.IsAny <PipelineContext <BasicTestEntity> >(),
                       It.IsAny <ILogger>(),
                       It.IsAny <CancellationToken>()))
            .Callback((PipelineContext <BasicTestEntity> context, ILogger log, CancellationToken cancellationToken) => {
                MockHandleTwoPages(context);
                tokenSource.Cancel();
            })
            .Returns(Task.CompletedTask);

            this.pipeline.InnerPipeline = this.mockInnerPipeline.Object;

            try
            {
                await this.pipeline.ProcessAsync(getContext, NullLogger.Instance, tokenSource.Token).ConfigureAwait(false);

                Assert.Fail($"Expected {nameof(OperationCanceledException)} to be thrown.");
            }
            catch (OperationCanceledException) { }
        }
        public void PipelineFactory_GivenGetContext_BuildsExpectedPipeline()
        {
            var context = new GetContext <TestEntity>(
                EndpointName.Tests,
                null,
                new RequestOptions
            {
                IncludeSupplementalData = true,
                AutoPaging = false
            });

            var pipeline = (RequestPipeline)this.pipelineFactory.GetPipeline(context);

            Type[] expectedElementTypes =
            {
                typeof(RestClientGetHandler),
                typeof(GetResultsDeserializer),
                typeof(GetResultsMetaDeserializer),
                typeof(SupplementalDataDeserializer)
            };

            IPipelineElement[] actualElements = pipeline.PipelineElements.ToArray();

            AssertElements(expectedElementTypes, actualElements);
        }
예제 #10
0
        public async Task ExecuteOperationAsync_ApiExceptionsAreUnhandled()
        {
            var mockPipeline = new Mock <IPipeline>(MockBehavior.Strict);

            mockPipeline
            .Setup(h => h.ProcessAsync(
                       It.IsAny <PipelineContext <BasicTestEntity> >(),
                       It.IsAny <ILogger>(),
                       It.IsAny <CancellationToken>()))
            .Callback((PipelineContext <BasicTestEntity> context, ILogger log, CancellationToken cancellationToken) => {
                throw new ConflictException("conflict", "conflict", null);
            })
            .Returns(Task.CompletedTask);

            this.mockPipelineFactory
            .Setup(h => h.GetPipeline(
                       It.IsAny <PipelineContext <BasicTestEntity> >()))
            .Returns(mockPipeline.Object);

            var getContext = new GetContext <BasicTestEntity>(EndpointName.Tests, null);

            var tokenSource = new CancellationTokenSource();

            tokenSource.Cancel();

            try
            {
                await this.apiService.ExecuteOperationAsync(getContext, tokenSource.Token).ConfigureAwait(false);

                Assert.Fail($"Expected {nameof(ConflictException)} to be thrown.");
            }
            catch (ConflictException) { }
        }
예제 #11
0
        public async Task Pipeline_CallsEachElementInSequenceAsync()
        {
            var context          = new GetContext <TestEntity>(EndpointName.Tests, filter: null, options: null);
            var pipelineElement1 = new Mock <IPipelineElement>(MockBehavior.Strict);
            var pipelineElement2 = new Mock <IPipelineElement>(MockBehavior.Strict);

            var callSequence = new List <string>();

            pipelineElement1.Setup(h => h.ProcessAsync(
                                       It.IsAny <PipelineContext <TestEntity> >(),
                                       It.IsAny <ILogger>(),
                                       It.IsAny <CancellationToken>()))
            .Callback((PipelineContext <TestEntity> c, ILogger l, CancellationToken ct) => callSequence.Add(nameof(pipelineElement1)))
            .Returns(Task.CompletedTask);

            pipelineElement2.Setup(h => h.ProcessAsync(
                                       It.IsAny <PipelineContext <TestEntity> >(),
                                       It.IsAny <ILogger>(),
                                       It.IsAny <CancellationToken>()))
            .Callback((PipelineContext <TestEntity> c, ILogger l, CancellationToken ct) => callSequence.Add(nameof(pipelineElement2)))
            .Returns(Task.CompletedTask);

            this.requestPipeline.AddStage(pipelineElement1.Object, pipelineElement2.Object);
            await this.requestPipeline.ProcessAsync(context, NullLogger.Instance, default).ConfigureAwait(false);

            Assert.IsTrue(callSequence.First().Equals(nameof(pipelineElement1)), $"Expected {nameof(pipelineElement1)} to be called first.");
            Assert.IsTrue(callSequence.Last().Equals(nameof(pipelineElement2)), $"Expected {nameof(pipelineElement2)} to be called second.");
        }
예제 #12
0
 public override object GetVariable(string name)
 {
     if (GetContext.ContainsKey(name))
     {
         return(SPCoderForm.ScriptStateCSharp.GetVariable(name));
     }
     return(null);
 }
예제 #13
0
 private void getService()
 {
     if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
     {
         var quartzStartup = (QuartzStartup)GetContext.getInstance().ServiceProvider.GetService(typeof(QuartzStartup));
         quartzStartup.rds.Clear();
     }
 }
예제 #14
0
 public Service(GetContext getContext)
 {
     this.getContext = getContext;
     Access          = new ServiceAccess(
         new Session(getContext).GetTicket,
         getUrl
         );
 }
예제 #15
0
        public void ProvjeraUcenika()
        {
            MojContext context = GetContext.get();

            OdrzanaNastavaController odrzanaNastavaController = new OdrzanaNastavaController(context);

            bool rezultat = odrzanaNastavaController.ProvjeriUcenika(1);

            Assert.AreEqual(true, rezultat);
        }
        /// <summary>
        /// Asynchronously Retrieve Effective Settings, with support for cancellation.
        /// </summary>
        /// <remarks>
        /// Retrieves a list of all effective settings associated with a single user,
        /// with filters to narrow down the results.
        /// </remarks>
        /// <param name="filter">
        /// An instance of the <see cref="EffectiveSettingsFilter"/> class, for narrowing down the results.
        /// </param>
        /// <param name="cancellationToken">
        /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>
        /// An instance of the <see cref="EffectiveSettings"/> class.
        /// </returns>
        public async Task <EffectiveSettings> GetEffectiveSettingsAsync(
            EffectiveSettingsFilter filter,
            CancellationToken cancellationToken)
        {
            var context = new GetContext <EffectiveSettings>(EndpointName.EffectiveSettings, filter);

            await ExecuteOperationAsync(context, cancellationToken).ConfigureAwait(false);

            return(context.Results.Items.FirstOrDefault());
        }
        /// <summary>
        /// Asynchronously Retrieve Last Modified Timestamps, with support for cancellation.
        /// </summary>
        /// <remarks>
        /// Retrieves a list of last modified timestamps associated with each requested API endpoint.
        /// </remarks>
        /// <param name="filter">
        /// An instance of the <see cref="LastModifiedTimestampsFilter"/> class, for narrowing down the results.
        /// </param>
        /// <param name="cancellationToken">
        /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>
        /// An instance of a <see cref="LastModifiedTimestamps"/> class.
        /// </returns>
        public async Task <LastModifiedTimestamps> GetLastModifiedTimestampsAsync(
            LastModifiedTimestampsFilter filter,
            CancellationToken cancellationToken)
        {
            var context = new GetContext <LastModifiedTimestamps>(EndpointName.LastModifiedTimestamps, filter);

            await ExecuteOperationAsync(context, cancellationToken).ConfigureAwait(false);

            return(context.Results.Items.FirstOrDefault());
        }
        /// <summary>
        /// Asynchronously Retrieve the Current User, with support for cancellation.
        /// </summary>
        /// <remarks>
        /// Retrieves the user object for the currently authenticated user. This is the
        /// user that authenticated to TSheets during the OAuth2 authentication process.
        /// </remarks>
        /// <param name="options">
        /// An instance of the <see cref="RequestOptions"/> class, for customizing method processing.
        /// </param>
        /// <param name="cancellationToken">
        /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>
        /// An instance of the <see cref="User"/> class, representing the current user, along
        /// with an output instance of the <see cref="ResultsMeta"/> class containing additional
        /// data.
        /// </returns>
        public async Task <(User, ResultsMeta)> GetCurrentUserAsync(
            RequestOptions options,
            CancellationToken cancellationToken)
        {
            var context = new GetContext <User>(EndpointName.CurrentUser, options);

            await ExecuteOperationAsync(context, cancellationToken).ConfigureAwait(false);

            return(context.Results.Items.FirstOrDefault(), context.ResultsMeta);
        }
        private void ColourPass(StandardFrameData frameData, DepthStencilView depthStencilView, RenderTargetView renderTargetView)
        {
            CurrentPass = Pass.Colour;

            GetContext.OutputMerger.SetRenderTargets(depthStencilView, renderTargetView);
            SetDepthStencilState(DepthStencilStates.EqualAndDisableWrite);
            SetRasterizerState(RasterizerStates.SolidBackCull);

            GetContext.InputAssembler.InputLayout = GetSharedItems.StandardInputLayout;
            SetVertexShader("CommonVS");
            SetPixelShader("ForwardPlusScenePS");
            GetContext.PixelShader.SetSampler(0, GetSharedItems.GetSamplerState(SamplerType.BilinearWrap));

            GetContext.UpdateSubresource(m_DirLightsConstBuffer, DirLightBuffer);
            GetContext.PixelShader.SetConstantBuffer(2, DirLightBuffer);

            // PreFiltered
            GetContext.PixelShader.SetShaderResource(5, GetSharedItems.PreFilteredMap);
            // Irradiance
            GetContext.PixelShader.SetShaderResource(6, GetSharedItems.IrradianceMap);

            //Lights data
            GetContext.PixelShader.SetShaderResource(7, LightCenterAndRadiusSRV);
            GetContext.PixelShader.SetShaderResource(8, LightParamsSRV);
            GetContext.PixelShader.SetShaderResource(9, LightColorSRV);
            GetContext.PixelShader.SetShaderResource(10, LightIndexSRV);

            // Draw scene
            string MeshName      = "";
            string MaterialName  = "";
            int    MaterialQueue = -999999;

            foreach (var rendererData in frameData.RenderersList)
            {
                if (MaterialName != rendererData.MaterialName)
                {
                    MaterialName = rendererData.MaterialName;
                    SetMaterial(MaterialName, MaterialQueue != rendererData.MaterialQueue);
                    MaterialQueue = rendererData.MaterialQueue;
                }

                if (MeshName != rendererData.MeshName)
                {
                    MeshName = rendererData.MeshName;
                    SetMesh(MeshName);
                }

                m_PerObjectConstBuffer.WorldMatrix         = rendererData.TransformMatrix;
                m_PerObjectConstBuffer.WorldViewMatrix     = rendererData.TransformMatrix * frameData.CamerasList[0].View;
                m_PerObjectConstBuffer.WorldViewProjMatrix = rendererData.TransformMatrix * frameData.CamerasList[0].ViewProjection;
                GetContext.UpdateSubresource(ref m_PerObjectConstBuffer, PerObjConstantBuffer);

                DX_DrawIndexed(m_CachedMesh.IndexCount, 0, 0);
            }
        }
        /// <summary>
        /// Asynchronously Retrieve LocationsMaps, with support for cancellation.
        /// </summary>
        /// <remarks>
        /// Retrieves a list of all locationsMaps associated with your company,
        /// with optional filters to narrow down the results.
        /// </remarks>
        /// <param name="filter">
        /// An instance of the <see cref="LocationFilter"/> class, for narrowing down the results.
        /// </param>
        /// <param name="options">
        /// An instance of the <see cref="RequestOptions"/> class, for customizing method processing.
        /// </param>
        /// <param name="cancellationToken">
        /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>
        /// An enumerable set of <see cref="Location"/> objects, along with an output
        /// instance of the <see cref="ResultsMeta"/> class containing additional data.
        /// </returns>
        public async Task <(IList <LocationsMap>, ResultsMeta)> GetLocationsMapsAsync(
            LocationsMapFilter filter,
            RequestOptions options,
            CancellationToken cancellationToken)
        {
            var context = new GetContext <LocationsMap>(EndpointName.LocationsMaps, filter, options);

            await ExecuteOperationAsync(context, cancellationToken).ConfigureAwait(false);

            return(context.Results.Items, context.ResultsMeta);
        }
        public async Task GetResultsMetaDeserializer_SetsMetaMoreFalseWhenMoreIsNotPresentAsync()
        {
            var context = new GetContext <TestEntity>(EndpointName.Tests, filter: null, options: null)
            {
                ResponseContent = @"{ ""more_is_not_present"": ""expect false"" }"
            };

            await this.pipelineElement.ProcessAsync(context, NullLogger.Instance, default).ConfigureAwait(false);

            Assert.IsFalse(context.ResultsMeta.More, "Expected ResultsMeta.More to be false");
        }
        /// <summary>
        /// Asynchronously Retrieve Custom Field Item User Filters, with support for cancellation.
        /// </summary>
        /// <remarks>
        /// Retrieves a list of all custom field item filters associated with a user, user, or group,
        /// with options to narrow down the results.
        /// </remarks>
        /// <param name="filter">
        /// An instance of the <see cref="CustomFieldItemUserFilterFilter"/> class, for narrowing down the results.
        /// </param>
        /// <param name="options">
        /// An instance of the <see cref="RequestOptions"/> class, for customizing method processing.
        /// </param>
        /// <param name="cancellationToken">
        /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>
        /// The set of the <see cref="CustomFieldItemUserFilter"/> objects retrieved, along with an output
        /// instance of the <see cref="ResultsMeta"/> class containing additional data.
        /// </returns>
        public async Task <(IList <CustomFieldItemUserFilter>, ResultsMeta)> GetCustomFieldItemUserFiltersAsync(
            CustomFieldItemUserFilterFilter filter,
            RequestOptions options,
            CancellationToken cancellationToken)
        {
            var context = new GetContext <CustomFieldItemUserFilter>(EndpointName.CustomFieldItemUserFilters, filter, options);

            await ExecuteOperationAsync(context, cancellationToken).ConfigureAwait(false);

            return(context.Results.Items, context.ResultsMeta);
        }
        /// <summary>
        /// Asynchronously Retrieve Schedule Calendars, with support for cancellation.
        /// </summary>
        /// <remarks>
        /// Retrieves a list of all schedule calendars associated with your
        /// employees, with optional filters to narrow down the results.
        /// </remarks>
        /// <param name="filter">
        /// An instance of the <see cref="ScheduleCalendarFilter"/> class, for narrowing down the results.
        /// </param>
        /// <param name="options">
        /// An instance of the <see cref="RequestOptions"/> class, for customizing method processing.
        /// </param>
        /// <param name="cancellationToken">
        /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>
        /// An enumerable set of <see cref="ScheduleCalendar"/> objects, along with an output
        /// instance of the <see cref="ResultsMeta"/> class containing additional data.
        /// </returns>
        public async Task <(IList <ScheduleCalendar>, ResultsMeta)> GetScheduleCalendarsAsync(
            ScheduleCalendarFilter filter,
            RequestOptions options,
            CancellationToken cancellationToken)
        {
            var context = new GetContext <ScheduleCalendar>(EndpointName.ScheduleCalendars, filter, options);

            await ExecuteOperationAsync(context, cancellationToken).ConfigureAwait(false);

            return(context.Results.Items, context.ResultsMeta);
        }
        /// <summary>
        /// Asynchronously Retrieve Jobcode Assignments, with support for cancellation.
        /// </summary>
        /// <remarks>
        /// Retrieves a list of all jobcode assignments associated with users,
        /// with optional filters to narrow down the results.
        /// </remarks>
        /// <param name="filter">
        /// An instance of the <see cref="JobcodeAssignmentFilter"/> class, for narrowing down the results.
        /// </param>
        /// <param name="options">
        /// An instance of the <see cref="RequestOptions"/> class, for customizing method processing.
        /// </param>
        /// <param name="cancellationToken">
        /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>
        /// An enumerable set of <see cref="JobcodeAssignment"/> objects, along with an output
        /// instance of the <see cref="ResultsMeta"/> class containing additional data.
        /// </returns>
        public async Task <(IList <JobcodeAssignment>, ResultsMeta)> GetJobcodeAssignmentsAsync(
            JobcodeAssignmentFilter filter,
            RequestOptions options,
            CancellationToken cancellationToken)
        {
            var context = new GetContext <JobcodeAssignment>(EndpointName.JobcodeAssignments, filter, options);

            await ExecuteOperationAsync(context, cancellationToken).ConfigureAwait(false);

            return(context.Results.Items, context.ResultsMeta);
        }
예제 #25
0
        /// <summary>
        /// Asynchronously Retrieve Deleted Timesheets, with support for cancellation.
        /// </summary>
        /// <remarks>
        /// Retrieves a list of all deleted timesheets associated with your company,
        /// with optional filters to narrow down the results.
        /// </remarks>
        /// <param name="filter">
        /// An instance of the <see cref="TimesheetsDeletedFilter"/> class, for narrowing down the results.
        /// </param>
        /// <param name="options">
        /// An instance of the <see cref="RequestOptions"/> class, for customizing method processing.
        /// </param>
        /// <param name="cancellationToken">
        /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>
        /// An enumerable set of <see cref="TimesheetsDeleted"/> objects, along with an output
        /// instance of the <see cref="ResultsMeta"/> class containing additional data.
        /// </returns>
        public async Task <(IList <TimesheetsDeleted>, ResultsMeta)> GetTimesheetsDeletedAsync(
            TimesheetsDeletedFilter filter,
            RequestOptions options,
            CancellationToken cancellationToken)
        {
            var context = new GetContext <TimesheetsDeleted>(EndpointName.TimesheetsDeleted, filter, options);

            await ExecuteOperationAsync(context, cancellationToken).ConfigureAwait(false);

            return(context.Results.Items, context.ResultsMeta);
        }
        public void JsonPaths_ReturnsExpectedResults()
        {
            foreach (KeyValuePair <EndpointName, string> mapping in ExpectedJsonPaths)
            {
                EndpointName endpointName     = mapping.Key;
                string       expectedJsonPath = mapping.Value;

                var    pipelineContext = new GetContext <TestEntity>(mapping.Key, null);
                string actualJsonPath  = pipelineContext.JsonPath();

                Assert.AreEqual(expectedJsonPath, actualJsonPath);
            }
        }
예제 #27
0
        protected void ColourPass(StandardFrameData frameData)
        {
            CurrentPass = Pass.ColourPass;
            GetContext.OutputMerger.SetRenderTargets(GetDisplay.DepthStencilViewRef, ScreenQuadTarget.View);
            SetDepthStencilState(DepthStencilStates.EqualAndDisableWrite);

            SetVertexShader("CommonVS");
            GetContext.InputAssembler.InputLayout = GetSharedItems.StandardInputLayout;

            if (EnabledHDR)
            {
            }
            else
            {
            }

            // Draw scene
            string MeshName      = "";
            string MaterialName  = "";
            int    MaterialQueue = -999999;

            m_ShadowLightsDataBuffer[0].LightViewProjectionMatrix = frameData.LightsList[0].ViewProjection;
            m_ShadowLightsDataBuffer[0].LeftTop     = Vector2.Zero;
            m_ShadowLightsDataBuffer[0].RightBottom = Vector2.One;
            GetContext.UpdateSubresource(m_ShadowLightsDataBuffer, ShadowLightsDataBuffer);
            StandardFrameData.RendererData rendererData;
            foreach (var index in frameData.PerCameraRenderersList[0])
            {
                rendererData = frameData.RenderersList[index];
                if (MaterialName != rendererData.MaterialName)
                {
                    MaterialName = rendererData.MaterialName;
                    SetMaterial(MaterialName, MaterialQueue != rendererData.MaterialQueue);
                    MaterialQueue = rendererData.MaterialQueue;
                }

                if (MeshName != rendererData.MeshName)
                {
                    MeshName = rendererData.MeshName;
                    SetMesh(MeshName);
                }

                m_PerObjectConstBuffer.WorldMatrix         = rendererData.TransformMatrix;
                m_PerObjectConstBuffer.WorldViewMatrix     = rendererData.TransformMatrix * frameData.CamerasList[0].View;
                m_PerObjectConstBuffer.WorldViewProjMatrix = rendererData.TransformMatrix * frameData.CamerasList[0].ViewProjection;
                GetContext.UpdateSubresource(ref m_PerObjectConstBuffer, PerObjConstantBuffer);

                DX_DrawIndexed(m_CachedMesh.IndexCount, 0, 0);
            }
        }
        public async Task GetResultsMetaDeserializer_SetsMetaPageValueAsync()
        {
            const int expectedPage = 3;
            var       options      = new RequestOptions {
                Page = expectedPage
            };
            var context = new GetContext <TestEntity>(EndpointName.Tests, filter: null, options: options)
            {
                ResponseContent = @"{ ""more"": false }"
            };

            await this.pipelineElement.ProcessAsync(context, NullLogger.Instance, default).ConfigureAwait(false);

            Assert.AreEqual(expectedPage, context.ResultsMeta.Page, $"Expected ResultsMeta.Page to be {expectedPage}.");
        }
        public async Task GetResultsDeserializer_CorrectlyDeserializesResultsAsync()
        {
            var expectedResult0 = new BasicTestEntity(1, "Larry");
            var expectedResult1 = new BasicTestEntity(2, "Mary");

            GetContext <BasicTestEntity> context = GetContext <BasicTestEntity>();

            await this.pipelineElement.ProcessAsync(context, NullLogger.Instance, default).ConfigureAwait(false);

            const int expectedCount = 2;

            Assert.AreEqual(expectedCount, context.Results.Items.Count, $"Expected {expectedCount} results.");
            Assert.AreEqual(context.Results.Items[0], expectedResult0);
            Assert.AreEqual(context.Results.Items[1], expectedResult1);
        }
        public override void Draw(StandardFrameData frameData)
        {
            // Clear
            DepthStencilView depthStencilView = GetDisplay.DepthStencilViewRef;
            RenderTargetView renderTargetView = GetDisplay.RenderTargetViewRef;

            GetContext.ClearRenderTargetView(renderTargetView, Color.Gray);
            GetContext.ClearDepthStencilView(depthStencilView,
                                             DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, 0.0f, 0);

            DepthPrePass(frameData, depthStencilView, renderTargetView);
            LightCullingPass(frameData);
            ColourPass(frameData, depthStencilView, renderTargetView);
            //TODO: colour pass
        }
        private void ScreenQuadPass(StandardFrameData frameData, DepthStencilView depthStencilView, RenderTargetView renderTargetView)
        {
            GetContext.OutputMerger.SetRenderTargets(null, downSamplingTargetView);
            SetDepthStencilState(DepthStencilStates.Greater);
            SetBlendState(BlendStates.Opaque);
            GetContext.Rasterizer.SetViewport(new Viewport(
                                                  0, 0,
                                                  RenderBackend.DisplayRef.Width / 4,
                                                  RenderBackend.DisplayRef.Height / 4,
                                                  0.0f, 1.0f
                                                  ));

            SetVertexShader("ScreenQuadVS");
            //GetContext.VertexShader.SetConstantBuffer(0, null);
            //GetContext.VertexShader.SetConstantBuffer(1, null);
            GetContext.InputAssembler.InputLayout = QuadLayoyt;
            //GetContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.PointList;

            SetPixelShader("DownSamplingPS");
            GetContext.PixelShader.SetConstantBuffer(0, ScreenParameters);
            ScreenParametersBuffer.CurrentFPS = (int)(1.0f / RenderBackend.EngineRef.Time.DeltaTime);
            GetContext.UpdateSubresource(ref ScreenParametersBuffer, ScreenParameters);
            GetContext.PixelShader.SetShaderResource(0, hdrSRV);
            GetContext.PixelShader.SetShaderResource(1, null);
            GetContext.PixelShader.SetShaderResource(2, null);
            GetContext.PixelShader.SetSampler(0, RenderBackend.SharedRenderItems.GetSamplerState(SamplerType.BilinearClamp));
            RenderBackend.DrawWrapper(4, 0);

            GetContext.Rasterizer.SetViewport(new Viewport(
                                                  0, 0,
                                                  RenderBackend.DisplayRef.Width,
                                                  RenderBackend.DisplayRef.Height,
                                                  0.0f, 1.0f
                                                  ));
            GetContext.OutputMerger.SetRenderTargets(null, renderTargetView);

            SetPixelShader("ScreenQuadPS");
            GetContext.PixelShader.SetConstantBuffer(0, ScreenParameters);
            ScreenParametersBuffer.CurrentFPS = (int)(1.0f / RenderBackend.EngineRef.Time.DeltaTime);
            GetContext.UpdateSubresource(ref ScreenParametersBuffer, ScreenParameters);
            GetContext.PixelShader.SetShaderResource(0, hdrSRV);
            GetContext.PixelShader.SetShaderResource(1, velocitySRV);
            GetContext.PixelShader.SetShaderResource(2, RenderBackend.DisplayRef.DepthStencilSRVRef);
            GetContext.PixelShader.SetSampler(0, RenderBackend.SharedRenderItems.GetSamplerState(SamplerType.BilinearClamp));
            RenderBackend.DrawWrapper(4, 0);

            GetContext.PixelShader.SetConstantBuffer(0, PerObjConstantBuffer);
        }