-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from RevealBi/unittest/google-services-data-so…
…urces Unittest/google services data sources
- Loading branch information
Showing
8 changed files
with
372 additions
and
0 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
{ | ||
// 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")); | ||
} | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleBigQueryDataSourceItemFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")); | ||
} | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleDriveDataSourceItemFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")); | ||
} | ||
} | ||
} |
99 changes: 99 additions & 0 deletions
99
src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleSheetsDataSourceItemFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")); | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleAnalytics4DataSourceFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleBigQueryDataSourceFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")); | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleDriveDataSourceFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleSheetsDataSourceFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |