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 FirstSetup() { _configuration = new ConfigurationBuilder() .AddJsonFile("test.appsettings.json") .Build(); var strConn = _configuration.GetConnectionString("mainDb"); _testUtilitiesImpl = new TestUtilitiesImpl(strConn); _drawingDal = new DrawingDalImpl(_configuration); _documentService = new DocumentServiceImpl(_drawingDal); _signUpService = new SignUpServiceImpl(_drawingDal); _createdUsers = _testUtilitiesImpl.CreateUserDummyData(_signUpService, 1); _createdDocuments = _testUtilitiesImpl.CreateDocumentDummyData(_documentService, 1, _createdUsers[0]); }
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); }