private VSOController CreateVSOController() { var fakeSourceRepositoryFactory = new SourceControlSync.Domain.Fakes.StubISourceRepositoryFactory() { CreateSourceRepositoryString = (connectionString) => { return fakeSourceRepository; } }; var fakeDestinationRepositoryFactory = new SourceControlSync.Domain.Fakes.StubIDestinationRepositoryFactory() { CreateDestinationRepositoryString = (connectionString) => { return fakeDestinationRepository; } }; var controller = new VSOController( fakeSourceRepositoryFactory, fakeDestinationRepositoryFactory, fakeChangesCalculator, fakeChangesReport, fakeErrorReport ); controller.Request = new HttpRequestMessage(HttpMethod.Post, ""); controller.Request.Headers.Add(VSOController.HEADER_SOURCE_CONNECTIONSTRING, ""); controller.Request.Headers.Add(VSOController.HEADER_DESTINATION_CONNECTIONSTRING, ""); controller.Request.Headers.Add(VSOController.HEADER_ROOT, "/"); return controller; }
public void PostNoHeaders() { var pushEvent = CreateVSOCodePushedRequest("5597f65ce55386a771e4bf6fa190b5a26c0f5ce5", "2015-08-16T04:28:13Z"); using (var controller = new VSOController(null, null, null, null, null)) { controller.Request = new HttpRequestMessage(HttpMethod.Post, ""); var result = controller.PostAsync(pushEvent, CancellationToken.None).Result; Assert.IsInstanceOfType(result, typeof(BadRequestErrorMessageResult)); } }