public void TestGetSharedDocument_GetSharedDocumentsResponseOk() { const int dataCount = 3; var expectedType = typeof(GetSharedDocumentsResponseOk); //given a database with some documents and a user that has document shared with var dummyDocumentData = _testUtilitiesImpl .CreateDocumentDummyData(_documentService, dataCount, _createdUsers[CreatedPlayersAmount - 1]); var shared = _sharingService.ShareDocument(new ShareDocumentRequest { DocId = dummyDocumentData[0], UserId = _createdUsers[0] }); //when we get shared documents var request = new GetSharedDocumentsRequest { UserId = _createdUsers[0] }; var result = _sharingService.GetSharedDocument(request); //the we get GetSharedDocumentsResponseOk Assert.Multiple(() => { Assert.That(result, Is.TypeOf(expectedType)); Assert.That(((GetSharedDocumentsResponseOk)result).Documents.Count(), Is.GreaterThanOrEqualTo(1)); }); _testUtilitiesImpl.DeleteDocumentDummyData(dummyDocumentData, _documentService); }
public void TestGetDocumentByNonExistingId_GetDocumentResponseInvalidId(string id) { var expectedType = typeof(GetDocumentResponseInvalidId); const int dataCount = 5; //given a database with some demo data var dummyData = _testUtilitiesImpl .CreateDocumentDummyData(_documentService, dataCount, _createdUsers[0]); //when we try to get a document with non existing id var result = _documentService.GetDocumentById(id); //then we get GetDocumentResponseInvalidId as a response Assert.IsInstanceOf(expectedType, result); _testUtilitiesImpl.DeleteDocumentDummyData(dummyData, _documentService); }
public void FinalTearDown() { _testUtilitiesImpl.DestroyUserDummyData(_createdUsers.ToArray()); _testUtilitiesImpl.DeleteDocumentDummyData(_createdDocuments, _documentService); }