public void AddExternalDataSet_returns_datasetdetail_fileurl_with_url() { //arrange var mock = new Mock <IDataSetSchemaService>(); var repositoryDataSetSchema = new MemoryRepository <DataSetSchema>(); mock.Setup(x => x.Repository).Returns(repositoryDataSetSchema); _dataSetSchemaService = mock.Object; var sut = new DataSetDetailUploaderService(_dataSetSchemaService, _repositoryDataSetDetail, _csvProcessor, _sqlRepo); //act var result = sut.AddExternalDataSet(1, "title", "url", "type"); //assert Assert.AreEqual("url", result.FileUrl); //cleanup _dataSetSchemaService = null; }
public void AddExternalDataSet_add_dataset_into_repository() { //arrange var mock = new Mock <IDataSetSchemaService>(); var repositoryDataSetSchema = new MemoryRepository <DataSetSchema>(); mock.Setup(x => x.Repository).Returns(repositoryDataSetSchema); _dataSetSchemaService = mock.Object; var sut = new DataSetDetailUploaderService(_dataSetSchemaService, _repositoryDataSetDetail, _csvProcessor, _sqlRepo); //act var result = sut.AddExternalDataSet(1, "titleinserted", "url", "type"); var resultfromrepo = _repositoryDataSetDetail.GetQuery().FirstOrDefault(x => x.Title == "titleinserted"); //assert Assert.AreEqual("titleinserted", resultfromrepo.Title); //cleanup _dataSetSchemaService = null; }