Beispiel #1
0
        public void BasicImport_Should_GiveError_When_NotUniqueCustomerListIsGiven()
        {
            //arrange
            var userId    = Guid.NewGuid();
            var customers = CreateBasicImportCustomersWithDuplicatedTitles(userId);

            //act
            var resp = _service.DoBasicImport(customers.ToArray());

            //assert
            Assert.True(resp.Type == ResponseType.ValidationError);
            Assert.True(resp.ErrorCode == ErrorCode.CustomerTitleConflict);
        }
Beispiel #2
0
        public IActionResult Basic([FromBody] BasicDataImportViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(GetModelStateErrorResponse(ModelState)));
            }

            var customers = GetMappedCustomers(model);

            var resp = _importBusiness.DoBasicImport(customers.ToArray());

            return(Ok(resp));
        }