Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unittest/google services data sources #77

Merged
merged 9 commits into from
Nov 14, 2024
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Reveal.Sdk.Dom.Core.Extensions;
using Reveal.Sdk.Dom.Data;
using Xunit;

namespace Reveal.Sdk.Dom.Tests.Data.DataSourceItems
{
public class GoogleAnalytics4DataSourceItemFixture
{
[Fact]
public void Constructor_SetsTitleAndDatasource_AsProvided()
hainv-ohio marked this conversation as resolved.
Show resolved Hide resolved
{
// Arrange
var dataSource = new GoogleAnalytics4DataSource();
var title = "Test title";

// Act
var dataSourceItem = new GoogleAnalytics4DataSourceItem(title, dataSource);

// Assert
Assert.Equal(title, dataSourceItem.Title);
Assert.Equal(dataSource, dataSourceItem.DataSource);
}

[Fact]
public void AccountId_SaveValueAndProperties_WhenSet()
{
// Arrange
var dataSource = new GoogleAnalytics4DataSource();
var dataSourceItem = new GoogleAnalytics4DataSourceItem("Test", dataSource);
var accountId = "TestAccountId";

// Act
dataSourceItem.AccountId = accountId;

// Assert
Assert.Equal(accountId, dataSourceItem.AccountId);
Assert.Equal(accountId, dataSourceItem.Properties.GetValue<string>("AccountId"));
}

[Fact]
public void PropertyId_SaveValueAndProperties_WhenSet()
{
// Arrange
var dataSource = new GoogleAnalytics4DataSource();
var dataSourceItem = new GoogleAnalytics4DataSourceItem("Test", dataSource);
var propertyId = "TestPropertyId";

// Act
dataSourceItem.PropertyId = propertyId;

// Assert
Assert.Equal(propertyId, dataSourceItem.PropertyId);
Assert.Equal(propertyId, dataSourceItem.Properties.GetValue<string>("PropertyId"));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Reveal.Sdk.Dom.Core.Extensions;
using Reveal.Sdk.Dom.Data;
using Xunit;

namespace Reveal.Sdk.Dom.Tests.Data.DataSourceItems
{
public class GoogleBigQueryDataSourceItemFixture
{
[Fact]
public void Constructor_SetsTitleAndDatasource_AsProvided()
{
// Arrange
var dataSource = new GoogleBigQueryDataSource();
var title = "Test title";

// Act
var dataSourceItem = new GoogleBigQueryDataSourceItem(title, dataSource);

// Assert
Assert.Equal(title, dataSourceItem.Title);
Assert.Equal(dataSource, dataSourceItem.DataSource);
}

[Fact]
public void DataSetId_SaveValueAndProperties_WhenSet()
{
// Arrange
var dataSource = new GoogleBigQueryDataSource();
var dataSourceItem = new GoogleBigQueryDataSourceItem("Test", dataSource);
var datasetId = "DatasetId";

// Act
dataSourceItem.DataSetId = datasetId;

// Assert
Assert.Equal(datasetId, dataSourceItem.DataSetId);
Assert.Equal(datasetId, dataSourceItem.Properties.GetValue<string>("DataSetId"));
}

[Fact]
public void PropertyId_SaveValueAndProperties_WhenSet()
{
// Arrange
var dataSource = new GoogleBigQueryDataSource();
var dataSourceItem = new GoogleBigQueryDataSourceItem("Test", dataSource);
var projectId = "TestPropertyId";

// Act
dataSourceItem.ProjectId = projectId;

// Assert
Assert.Equal(projectId, dataSourceItem.ProjectId);
Assert.Equal(projectId, dataSourceItem.Properties.GetValue<string>("ProjectId"));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Reveal.Sdk.Dom.Core.Extensions;
using Reveal.Sdk.Dom.Data;
using Xunit;

namespace Reveal.Sdk.Dom.Tests.Data.DataSourceItems
{
public class GoogleDriveDataSourceItemFixture
{
[Fact]
public void Constructor_SetsTitleAndDatasource_AsProvided()
{
// Arrange
var dataSource = new GoogleDriveDataSource();
var title = "Test title";

// Act
var dataSourceItem = new GoogleDriveDataSourceItem(title, dataSource);

// Assert
Assert.Equal(title, dataSourceItem.Title);
Assert.Equal(dataSource, dataSourceItem.DataSource);
}

[Fact]
public void Identitifer_SaveValueAndProperties_WhenSet()
{
// Arrange
var dataSource = new GoogleDriveDataSource();
var dataSourceItem = new GoogleDriveDataSourceItem("Test", dataSource);
var identifier = "IdentitiferTest";

// Act
dataSourceItem.Identitifer = identifier;

// Assert
Assert.Equal(identifier, dataSourceItem.Identitifer);
Assert.Equal(identifier, dataSourceItem.Properties.GetValue<string>("Identitifer"));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Reveal.Sdk.Dom.Core.Extensions;
using Reveal.Sdk.Dom.Data;
using Xunit;

namespace Reveal.Sdk.Dom.Tests.Data.DataSourceItems
{
public class GoogleSheetsDataSourceItemFixture
{
[Fact]
public void Constructor_SetsTitleAndDatasource_AsProvided()
{
// Arrange
var dataSource = new GoogleSheetsDataSource();
var title = "Test title";

// Act
var dataSourceItem = new GoogleSheetsDataSourceItem(title, dataSource);

// Assert
Assert.Equal(title, dataSourceItem.Title);
Assert.Equal(dataSource, dataSourceItem.DataSource);
}

[Fact]
public void FirstRowContainsLabels_SaveValueAndProperties_WhenSet()
{
// Arrange
var dataSource = new GoogleSheetsDataSource();
var dataSourceItem = new GoogleSheetsDataSourceItem("Test", dataSource);

// Act 1
dataSourceItem.FirstRowContainsLabels = true;

// Assert
Assert.True(dataSourceItem.FirstRowContainsLabels);
Assert.True(dataSourceItem.Properties.GetValue<bool>("FirstRowContainsLabels"));

// Act 1
dataSourceItem.FirstRowContainsLabels = false;

// Assert
Assert.False(dataSourceItem.FirstRowContainsLabels);
Assert.False(dataSourceItem.Properties.GetValue<bool>("FirstRowContainsLabels"));
}

[Fact]
public void NamedRange_SaveValueAndProperties_WhenSet()
{
// Arrange
var dataSource = new GoogleSheetsDataSource();
var dataSourceItem = new GoogleSheetsDataSourceItem("Test", dataSource);
var namedRange = "NamedRangeTest";

// Act
dataSourceItem.NamedRange = namedRange;

// Assert
Assert.Equal(namedRange, dataSourceItem.NamedRange);
Assert.Equal(namedRange, dataSourceItem.Properties.GetValue<string>("NamedRange"));
}

[Fact]
public void PivotTable_SaveValueAndProperties_WhenSet()
{
// Arrange
var dataSource = new GoogleSheetsDataSource();
var dataSourceItem = new GoogleSheetsDataSourceItem("Test", dataSource);
var pivotTable = "PivotTableTest";

// Act
dataSourceItem.PivotTable = pivotTable;

// Assert
Assert.Equal(pivotTable, dataSourceItem.PivotTable);
Assert.Equal(pivotTable, dataSourceItem.Properties.GetValue<string>("PivotTable"));
}

[Fact]
public void Sheet_SaveValueAndProperties_WhenSet()
{
// Arrange
var dataSource = new GoogleSheetsDataSource();
var dataSourceItem = new GoogleSheetsDataSourceItem("Test", dataSource);
var sheet = "SheetTest";

// Act
dataSourceItem.Sheet = sheet;

// Assert
Assert.Equal(sheet, dataSourceItem.Sheet);
Assert.Equal(sheet, dataSourceItem.Properties.GetValue<string>("Sheet"));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Reveal.Sdk.Dom.Data;
using Xunit;

namespace Reveal.Sdk.Dom.Tests.Data.DataSources
{
public class GoogleAnalytics4DataSourceFixture
{
[Fact]
public void Constructor_SetProviderToGoogleAnalytics4_WhenConstructed()
{
// Act
var dataSource = new GoogleAnalytics4DataSource();

// Assert
Assert.Equal(DataSourceProvider.GoogleAnalytics4, dataSource.Provider);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Reveal.Sdk.Dom.Core.Extensions;
using Reveal.Sdk.Dom.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace Reveal.Sdk.Dom.Tests.Data.DataSources
{
public class GoogleBigQueryDataSourceFixture
{
[Fact]
public void Constructor_SetProviderToGoogleBigQuery_WhenConstructed()
{
// Act
var dataSource = new GoogleBigQueryDataSource();

// Assert
Assert.Equal(DataSourceProvider.GoogleBigQuery, dataSource.Provider);
}

[Fact]
public void ProjectId_SaveValueAndProperties_WhenSet()
{
// Arrange
var dataSource = new GoogleBigQueryDataSource();
var projectId = "TestProjectId";

// Act
dataSource.ProjectId = projectId;

// Assert
Assert.Equal(projectId, dataSource.ProjectId);
Assert.Equal(projectId, dataSource.Properties.GetValue<string>("ProjectId"));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Reveal.Sdk.Dom.Core.Extensions;
using Reveal.Sdk.Dom.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace Reveal.Sdk.Dom.Tests.Data.DataSources
{
public class GoogleDriveDataSourceFixture
{
[Fact]
public void Constructor_SetProviderToGoogleDrive_WhenConstructed()
{
// Act
var dataSource = new GoogleDriveDataSource();

// Assert
Assert.Equal(DataSourceProvider.GoogleDrive, dataSource.Provider);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Reveal.Sdk.Dom.Core.Extensions;
using Reveal.Sdk.Dom.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace Reveal.Sdk.Dom.Tests.Data.DataSources
{
public class GoogleSheetsDataSourceFixture
{

[Fact]
public void Constructor_SetProviderToGoogleSheets_WhenConstructed()
{
// Act
var dataSource = new GoogleSheetsDataSource();

// Assert
Assert.Equal(DataSourceProvider.GoogleSheets, dataSource.Provider);
}
}
}
Loading