Пример #1
0
        public void CreateDayBatch(string instrumentName, string serverParkName, DateTime dayBatchDate)
        {
            instrumentName.ThrowExceptionIfNullOrEmpty("instrumentName");
            serverParkName.ThrowExceptionIfNullOrEmpty("serverParkName");

            _catiService.CreateDayBatch(_connectionModel, instrumentName, serverParkName, dayBatchDate);
        }
Пример #2
0
        public IHttpActionResult CreateDayBatch([FromUri] string serverParkName, [FromUri] string instrumentName, [FromBody] CreateDayBatchDto createDayBatchDto)
        {
            _loggingService.LogInfo($"Create a daybatch for instrument '{instrumentName}' on server park '{serverParkName}' for '{createDayBatchDto.DayBatchDate}'");

            var dayBatchDto = _catiService.CreateDayBatch(instrumentName, serverParkName, createDayBatchDto);

            _loggingService.LogInfo($"Daybatch created for instrument '{instrumentName}' on '{createDayBatchDto.DayBatchDate}'");

            return(Created($"{Request.RequestUri}", dayBatchDto));
        }
Пример #3
0
        public DayBatchModel CreateDayBatch(string instrumentName, string serverParkName,
                                            DateTime dayBatchDate, bool checkForTreatedCases)
        {
            instrumentName.ThrowExceptionIfNullOrEmpty("instrumentName");
            serverParkName.ThrowExceptionIfNullOrEmpty("serverParkName");

            if (_caseService.GetNumberOfCases(_connectionModel, instrumentName, serverParkName) == 0)
            {
                throw new DataNotFoundException($"There are no cases available in '{instrumentName}' to create a daybatch");
            }

            return(_catiService.CreateDayBatch(_connectionModel, instrumentName, serverParkName, dayBatchDate, checkForTreatedCases));
        }
Пример #4
0
        public void Given_A_SurveyDay_Exists_When_I_Call_CreateDayBatch_Then_The_Correct_Service_Is_Called(bool checkForTreatedCases)
        {
            //arrange
            const string instrumentName = "OPN2101A";
            const string serverParkName = "ServerParkA";

            _createDayBatchDto.CheckForTreatedCases = checkForTreatedCases;

            _blaiseCatiApiMock.Setup(b =>
                                     b.CreateDayBatch(instrumentName, serverParkName, (DateTime)_createDayBatchDto.DayBatchDate, checkForTreatedCases));

            _mapperMock.Setup(m => m.MapToDayBatchDto(It.IsAny <DayBatchModel>()))
            .Returns(new DayBatchDto());

            //act
            _sut.CreateDayBatch(instrumentName, serverParkName, _createDayBatchDto);

            //assert
            _blaiseCatiApiMock.Verify(v => v.CreateDayBatch(instrumentName, serverParkName,
                                                            (DateTime)_createDayBatchDto.DayBatchDate, (bool)_createDayBatchDto.CheckForTreatedCases), Times.Once);
        }
Пример #5
0
        public void Given_A_SurveyDay_Exists_When_I_Call_CreateDayBatch_Then_The_Correct_Service_Is_Called()
        {
            //arrange
            const string instrumentName = "OPN2101A";
            const string serverParkName = "ServerParkA";

            _blaiseApiMock.Setup(b =>
                                 b.CreateDayBatch(instrumentName, serverParkName, _dayBatchDto.DaybatchDate));

            //act
            _sut.CreateDayBatch(instrumentName, serverParkName, _dayBatchDto);

            //assert
            _blaiseApiMock.Verify(v => v.CreateDayBatch(instrumentName, serverParkName, _dayBatchDto.DaybatchDate), Times.Once);
        }