Beispiel #1
0
            public void Setup()
            {
                var container = TestControllerBuilder.GetWindsorContainer();

                var pipelineFactory =
                    new PipelineFactory(container, null, null, null, null, new SingleStepPipelineProviderForTest(typeof(DeleteReferentialExceptionStep <, , ,>)));
                var controller = TestControllerBuilder.GetController <StudentsController>(pipelineFactory, this._id.ToString("N"));

                _id = Guid.NewGuid();
                _responseMessage = controller.Delete(_id)
                                   .GetResultSafely()
                                   .ExecuteAsync(new CancellationToken())
                                   .GetResultSafely();
            }
Beispiel #2
0
            public void Setup()
            {
                var container = TestControllerBuilder.GetWindsorContainer();

                var pipelineFactory =
                    new PipelineFactory(container, new SingleStepPipelineProviderForTest(typeof(NotFoundExceptionStep <, , ,>)), null, null, null, null);

                var controller = TestControllerBuilder.GetController <StudentsController>(pipelineFactory);

                _id = Guid.NewGuid();

                _responseMessage = controller.Get(_id)
                                   .GetResultSafely()
                                   .ExecuteAsync(new CancellationToken())
                                   .GetResultSafely();
            }
Beispiel #3
0
            public void Setup()
            {
                var container = TestControllerBuilder.GetWindsorContainer();

                var pipelineFactory =
                    new PipelineFactory(
                        container, null, new SingleStepPipelineProviderForTest(typeof(SimpleGetManyResourceCreationStep <, , ,>)),
                        null, null, null);

                var controller = TestControllerBuilder.GetController <StudentsController>(pipelineFactory);

                _responseMessage = controller.GetAll(new UrlQueryParametersRequest())
                                   .GetResultSafely()
                                   .ExecuteAsync(new CancellationToken())
                                   .GetResultSafely();
            }
Beispiel #4
0
            public void Setup()
            {
                var container = TestControllerBuilder.GetWindsorContainer();

                var pipelineFactory =
                    new PipelineFactory(container, null, null, null, null, new SingleStepPipelineProviderForTest(typeof(ConcurrencyExceptionStep <, , ,>)));

                var controller = TestControllerBuilder.GetController <StudentsController>(pipelineFactory, this._id.ToString("N"));

                _id = Guid.NewGuid();
                controller.Request.Headers.IfMatch.Add(new EntityTagHeaderValue(this._id.ToString("N").Quoted()));

                _responseMessage = controller.Delete(this._id)
                                   .GetResultSafely()
                                   .ExecuteAsync(new CancellationToken())
                                   .GetResultSafely();
            }
Beispiel #5
0
            public void Should_return_forbidden()
            {
                var id        = Guid.NewGuid();
                var container = TestControllerBuilder.GetWindsorContainer();

                var pipelineFactory =
                    new PipelineFactory(container, null, null, null, null, new SingleStepPipelineProviderForTest(typeof(EdFiSecurityExceptionStep <, , ,>)));

                var controller = TestControllerBuilder.GetController <StudentsController>(pipelineFactory, id.ToString("N"));

                var responseMessage = controller.Delete(id)
                                      .GetResultSafely()
                                      .ExecuteAsync(new CancellationToken())
                                      .GetResultSafely();

                responseMessage.StatusCode.ShouldBe(HttpStatusCode.Forbidden);
            }
Beispiel #6
0
            public void Setup()
            {
                _locator = TestControllerBuilder.GetWindsorContainer();

                var pipelineFactory =
                    new PipelineFactory(
                        _locator, null, null, null, new SingleStepPipelineProviderForTest(typeof(PersistNewModel <, , ,>)), null);

                var controller = TestControllerBuilder.GetController <StudentsController>(pipelineFactory, _id.ToString("N"));

                controller.Request.Headers.Add("If-Match", "etag".Quoted());
                _id = Guid.NewGuid();

                _responseMessage = controller.Put(new StudentPut(), _id)
                                   .GetResultSafely()
                                   .ExecuteAsync(new CancellationToken())
                                   .GetResultSafely();
            }
Beispiel #7
0
            public void Setup()
            {
                _container = TestControllerBuilder.GetWindsorContainer();

                var pipelineFactory =
                    new PipelineFactory(
                        _container, null, null, null, new SingleStepPipelineProviderForTest(typeof(PersistExistingModel <, , ,>)),
                        null);

                var controller = TestControllerBuilder.GetController <StudentsController>(pipelineFactory, _id.ToString("N"));

                _id = Guid.NewGuid();

                _responseMessage = controller.Post(
                    new StudentPost {
                    ETag = _id.ToString("n")
                })
                                   .GetResultSafely()
                                   .ExecuteAsync(new CancellationToken())
                                   .GetResultSafely();
            }