public void When_Document_Is_Requested_Then_FileBytes_Is_Populated() { // Given var metadata = new DocumentDto() { Extension = "txt", Filename = "Test" }; Stream stream = new MemoryStream(); var file = new GetStreamedDocumentByIdResponse() { MetaData = metadata, Content = stream }; _streamingDocLibraryService .Setup(x => x.GetStreamedDocumentById(It.IsAny<GetStreamedDocumentByIdRequest>())) .Returns(file); // When var result = _target.DownloadDocument(_encryptedDocId1); // Then Assert.That(result.FileStream, Is.Not.Null); }
public void When_Document_Is_requested_Then_Should_Call_Correct_Methods() { // Given var metadata = new DocumentDto() { Extension = "txt", Filename = "Test" }; Stream stream = new MemoryStream(); var file = new GetStreamedDocumentByIdResponse() { MetaData = metadata, Content = stream }; _streamingDocLibraryService .Setup(x => x.GetStreamedDocumentById(It.IsAny<GetStreamedDocumentByIdRequest>())) .Returns(file); // When _target.DownloadDocument(_encryptedDocId1); // Then _streamingDocLibraryService.VerifyAll(); _documentService.Verify(x => x.ValidateDocumentForCompany(It.IsAny<long>(), It.IsAny<long>())); }