示例#1
0
        public void Should_Split_A_File_In_Chunks_For_Writing()
        {
            var mockDataService = new Mock <IFlowDocsOperations>();
            var sut             = new FlowDocsDocument(mockDataService.Object);

            sut.ChunkSize = 10;

            var doc = "this is the document to send!."; //30 chars

            var docBytes = Encoding.Unicode.GetBytes(doc);

            var oid            = Guid.NewGuid();
            var uploadResponse = new UploadDocumentResponse {
                OidDocument = oid
            };

            mockDataService.Setup(x => x.UploadDocument(Moq.It.IsAny <UploadDocumentRequest>()))
            .Returns(uploadResponse);

            var info = new DocumentInfo {
                DocumentName = "Name", Path = "path", Description = "desc", Owner = "owner", Version = 1
            };

            sut.UploadDocument(info, docBytes, DocumentUploadMode.NewVersion);

            mockDataService.Verify(x => x.UploadDocument(Moq.It.IsAny <UploadDocumentRequest>()), Times.Exactly(6));
        }
示例#2
0
        private Guid SetupTest_UploadDoc(FlowDocsDocument sut, DocumentInfo info, string fileName, DocumentUploadMode mode)
        {
            var OidUpload = sut.UploadDocument(info, fileName, mode);

            Oids.Add(OidUpload);

            return(OidUpload);
        }