Esempio n. 1
0
        public async Task WhenPostFromFile_ThenPublishAsync()
        {
            var request = new CreateJobFromFileRequest
            {
                FileName = Constants.ValidNSBDFileName
            };

            var job = new JobRequest { jobIdentifier = Guid.NewGuid().ToString() };

            ExpectJobRequestMapperToMap(job);
            ExpectExchangeToPublish();

            var sut = CreateController(new HttpRequestMessage());
            await sut.PostAsync(request);

            exchange.Verify(x => x.PublishAsync(job, It.IsAny<string>()));
        }
Esempio n. 2
0
        public async Task WhenPostFromFile_AndPublishAsyncFaults_ThenReturnInternalServerError()
        {
            var request = new CreateJobFromFileRequest
            {
                FileName = Constants.ValidNSBDFileName
            };

            var job = new JobRequest { jobIdentifier = Guid.NewGuid().ToString() };

            ExpectJobRequestMapperToMap(job);
            ExpectExchangeToFaultOnPublish();

            var sut = CreateController(new HttpRequestMessage());
            var result = await sut.PostAsync(request);

            Assert.AreEqual(HttpStatusCode.InternalServerError, result.StatusCode);
        }
Esempio n. 3
0
 private void ExpectJobRequestMapperToMap(JobRequest jobRequest)
 {
     jobRequestMapper.Setup(x => x.Map(It.IsAny<CreateJobFromFileRequest>()))
         .Returns(jobRequest);
 }