public async Task CreateShouldSucceed()
        {
            //Arrange
            var id     = Guid.NewGuid();
            var source = "TestSource";
            var site   = "TestSite";
            var code   = "TestCode";
            var name   = "TestName";

            var operationalDepartment = new OperationalDepartment(id, code, name, site, source);

            //Act
            await _repository.CreateAsync(operationalDepartment);

            //Asssert
            var data = RepositoryHelper.ForOperationalDepartment.GetOperationalDepartments();

            data.Should().HaveCount(1);
            var result = data.First();

            result.Code.Should().Be(code);
            result.Id.Should().Be(id);
            result.Source.Should().Be(source);
            result.Name.Should().Be(name);
            result.Site.Should().Be(site);
        }
        public async Task <Result> Handle(CreateOperationalDepartmentCommand request, CancellationToken cancellationToken)
        {
            Result result;
            var    id = _identifierProvider.Generate();

            var _operationalDepartmentToCreate = new OperationalDepartment(id, request.Code, request.Name, request.Site, request.Source);

            _operationalDepartmentToCreate.Version = _versionProvider.Generate();

            try
            {
                await _operationalDepartmentWriteRepository.CreateAsync(_operationalDepartmentToCreate);

                result = Result.Ok(id, _operationalDepartmentToCreate.Version);
            }
            catch (UniqueKeyException)
            {
                result = Result.Fail(new System.Collections.Generic.List <Failure>()
                {
                    new HandlerFault()
                    {
                        Code    = HandlerFaultCode.Conflict.Name,
                        Message = HandlerFailures.CodeSourceSiteConflict,
                        Target  = "code-source-site"
                    }
                }
                                     );
            }
            catch
            {
                result = Result.Fail(CustomFailures.CreateOperationalDepartmentFailure);
            }

            return(result);
        }