public PSTable(Table table) { if (table == null) { throw new ArgumentNullException("table"); } if (table.Properties == null) { table.Properties = new TableProperties(); } this.table = table; }
public PSDataset(Table dataset) { if (dataset == null) { throw new ArgumentNullException("dataset"); } if (dataset.Properties == null) { dataset.Properties = new TableProperties(); } this.dataset = dataset; }
// ToDo: enable the tests when we can set readonly provisioning state in test //[Fact] //[Trait(Category.AcceptanceType, Category.CheckIn)] public void CanCreateDataset() { // Arrange Table expected = new Table() { Name = datasetName, Properties = new TableProperties() }; dataFactoriesClientMock.Setup(c => c.ReadJsonFileContent(It.IsAny<string>())) .Returns(rawJsonContent) .Verifiable(); dataFactoriesClientMock.Setup( c => c.CreatePSDataset( It.Is<CreatePSDatasetParameters>( parameters => parameters.Name == datasetName && parameters.ResourceGroupName == ResourceGroupName && parameters.DataFactoryName == DataFactoryName))) .CallBase() .Verifiable(); dataFactoriesClientMock.Setup( c => c.CreateOrUpdateDataset(ResourceGroupName, DataFactoryName, datasetName, rawJsonContent)) .Returns(expected) .Verifiable(); // Action cmdlet.File = filePath; cmdlet.Force = true; cmdlet.ExecuteCmdlet(); // Assert dataFactoriesClientMock.VerifyAll(); commandRuntimeMock.Verify( f => f.WriteObject( It.Is<PSDataset>( tbl => ResourceGroupName == tbl.ResourceGroupName && DataFactoryName == tbl.DataFactoryName && expected.Name == tbl.DatasetName)), Times.Once()); }
private static string GetFolderPath(Table dataArtifact) { AzureBlobLocation blobLocation; if (dataArtifact == null || dataArtifact.Properties == null) { return null; } blobLocation = dataArtifact.Properties.Location as AzureBlobLocation; if (blobLocation == null) { return null; } return blobLocation.FolderPath; }
public PSTable() { table = new Table() {Properties = new TableProperties()}; }
public void CanThrowIfDatasetProvisioningFailed() { // Arrange Table expected = new Table() { Name = datasetName, Properties = new TableProperties() }; dataFactoriesClientMock.Setup(c => c.ReadJsonFileContent(It.IsAny<string>())) .Returns(rawJsonContent) .Verifiable(); dataFactoriesClientMock.Setup( c => c.CreatePSDataset( It.Is<CreatePSDatasetParameters>( parameters => parameters.Name == datasetName && parameters.ResourceGroupName == ResourceGroupName && parameters.DataFactoryName == DataFactoryName))) .CallBase() .Verifiable(); dataFactoriesClientMock.Setup( c => c.CreateOrUpdateDataset(ResourceGroupName, DataFactoryName, datasetName, rawJsonContent)) .Returns(expected) .Verifiable(); // Action cmdlet.File = filePath; cmdlet.Force = true; // Assert Assert.Throws<ProvisioningFailedException>(() => cmdlet.ExecuteCmdlet()); }
// Get Folder Path for table private static string GetFolderPath(Table table) { if (table == null || table.Properties == null) { return null; } AzureBlobLocation blobLocation = table.Properties.Location as AzureBlobLocation; if (blobLocation == null) { return null; } return blobLocation.FolderPath + blobLocation.FileName; }
public PSDataset() { this.dataset = new Table() {Properties = new TableProperties()}; }