Ejemplo n.º 1
0
        public CreateDocumentOutput CreateDocument(CreateDocumentInput input)
        {
            if (_documentRepository.GetAll().Any(p => p.Name == input.Name))
                throw new AbpSingleMemberValidationException("Document already exists", "Name");
            var document = AutoMapper.Mapper.Map<Document>(input);
            document.CreateDraft();
            document.DraftRevision.AddBlankPage();
            var documentId = _documentRepository.InsertAndGetId(document);

            return new CreateDocumentOutput() { DocumentId = documentId };
        }
        public async Task Should_Get_One_Document_After_Insert()
        {
            //Arrange
            LoginAsDefaultTenantAdmin();

            var docInput = new HRConcourse.Documents.Dto.CreateDocumentInput() { Name = "Pepe" };
            //Act
            _documentsAppService.CreateDocument(docInput);

            //Assert
            var documents = _documentsAppService.GetDocuments(new GetDocumentsInput());

            documents.Documents.ShouldNotBeEmpty();
        }