From 8804554d3f48168d350a15e8ddb9a1fc3dd5c9b0 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 13 Nov 2024 16:13:06 +0700 Subject: [PATCH 1/9] apply test for GA4 datasource --- .../GoogleAnalytics4DataSourceFixture.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleAnalytics4DataSourceFixture.cs diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleAnalytics4DataSourceFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleAnalytics4DataSourceFixture.cs new file mode 100644 index 0000000..2943c1b --- /dev/null +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleAnalytics4DataSourceFixture.cs @@ -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_SetProvider_ToMicrosoftSqlServer() + { + // Act + var dataSource = new GoogleAnalytics4DataSource(); + + // Assert + Assert.Equal(DataSourceProvider.GoogleAnalytics4, dataSource.Provider); + } + } +} From 5c625fa1dafba0a15308d7588a7123289ef24fea Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 13 Nov 2024 16:13:20 +0700 Subject: [PATCH 2/9] apply tests for GA4 Data source item --- .../GoogleAnalytics4DataSourceItemFixture.cs | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs new file mode 100644 index 0000000..fb8922e --- /dev/null +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs @@ -0,0 +1,58 @@ +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_AsInputs() + { + // Arrange + var dataSource = new GoogleAnalytics4DataSource(); + + // Act + var dataSourceItem = new GoogleAnalytics4DataSourceItem("Test title", dataSource); + + // Assert + Assert.Equal("Test title", dataSourceItem.Title); + Assert.Equal(dataSource, dataSourceItem.DataSource); + } + + [Fact] + public void AccountId_GetAndSet_ShouldSetProperties() + { + // Arrange + var dataSource = new GoogleAnalytics4DataSource(); + var dataSourceItem = new GoogleAnalytics4DataSourceItem("Test", dataSource); + + // Act + dataSourceItem.AccountId = "TestAccountId"; + + // Assert + Assert.Equal("TestAccountId", dataSourceItem.AccountId); + Assert.Equal("TestAccountId", dataSourceItem.Properties.GetValue("AccountId")); + } + + [Fact] + public void PropertyId_GetAndSet_ShouldSetProperties() + { + // Arrange + var dataSource = new GoogleAnalytics4DataSource(); + var dataSourceItem = new GoogleAnalytics4DataSourceItem("Test", dataSource); + + // Act + dataSourceItem.PropertyId = "TestPropertyId"; + + // Assert + Assert.Equal("TestPropertyId", dataSourceItem.PropertyId); + Assert.Equal("TestPropertyId", dataSourceItem.Properties.GetValue("PropertyId")); + } + } +} From 1ace40cc2d5755a0b2b38d68c1337edbb90c43c0 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 13 Nov 2024 17:53:59 +0700 Subject: [PATCH 3/9] add google analytic ds item unit tests --- .../GoogleAnalytics4DataSourceItemFixture.cs | 53 +++++++++++++++---- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs index fb8922e..952949e 100644 --- a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs @@ -12,47 +12,78 @@ namespace Reveal.Sdk.Dom.Tests.Data.DataSourceItems public class GoogleAnalytics4DataSourceItemFixture { [Fact] - public void Constructor_SetsTitleAndDatasource_AsInputs() + public void Constructor_SetsTitleAndDatasource_AsProvided() { // Arrange var dataSource = new GoogleAnalytics4DataSource(); + var title = "Test title"; // Act - var dataSourceItem = new GoogleAnalytics4DataSourceItem("Test title", dataSource); + var dataSourceItem = new GoogleAnalytics4DataSourceItem(title, dataSource); // Assert - Assert.Equal("Test title", dataSourceItem.Title); + Assert.Equal(title, dataSourceItem.Title); Assert.Equal(dataSource, dataSourceItem.DataSource); } [Fact] - public void AccountId_GetAndSet_ShouldSetProperties() + public void AccountId_SaveValueAndProperties_WhenSet() { // Arrange var dataSource = new GoogleAnalytics4DataSource(); var dataSourceItem = new GoogleAnalytics4DataSourceItem("Test", dataSource); + var accountId = "TestAccountId"; // Act - dataSourceItem.AccountId = "TestAccountId"; + dataSourceItem.AccountId = accountId; // Assert - Assert.Equal("TestAccountId", dataSourceItem.AccountId); - Assert.Equal("TestAccountId", dataSourceItem.Properties.GetValue("AccountId")); + Assert.Equal(accountId, dataSourceItem.AccountId); + Assert.Equal(accountId, dataSourceItem.Properties.GetValue("AccountId")); } [Fact] - public void PropertyId_GetAndSet_ShouldSetProperties() + public void AccountId_ThrowsException_WhenSetToNull() { // Arrange var dataSource = new GoogleAnalytics4DataSource(); var dataSourceItem = new GoogleAnalytics4DataSourceItem("Test", dataSource); // Act - dataSourceItem.PropertyId = "TestPropertyId"; + Action act = () => dataSourceItem.AccountId = null; // Assert - Assert.Equal("TestPropertyId", dataSourceItem.PropertyId); - Assert.Equal("TestPropertyId", dataSourceItem.Properties.GetValue("PropertyId")); + Assert.Throws(act); + } + + [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("PropertyId")); + } + + [Fact] + public void PropertyId_ThrowsException_WhenSetToNull() + { + // Arrange + var dataSource = new GoogleAnalytics4DataSource(); + var dataSourceItem = new GoogleAnalytics4DataSourceItem("Test", dataSource); + + // Act + Action act = () => dataSourceItem.PropertyId = null; + + // Assert + Assert.Throws(act); } } } From 482a7318137591c1ccd6db08e8e557a39778412c Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 13 Nov 2024 17:57:06 +0700 Subject: [PATCH 4/9] rm test --- .../GoogleAnalytics4DataSourceItemFixture.cs | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs index 952949e..2c6620f 100644 --- a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs @@ -42,20 +42,6 @@ public void AccountId_SaveValueAndProperties_WhenSet() Assert.Equal(accountId, dataSourceItem.Properties.GetValue("AccountId")); } - [Fact] - public void AccountId_ThrowsException_WhenSetToNull() - { - // Arrange - var dataSource = new GoogleAnalytics4DataSource(); - var dataSourceItem = new GoogleAnalytics4DataSourceItem("Test", dataSource); - - // Act - Action act = () => dataSourceItem.AccountId = null; - - // Assert - Assert.Throws(act); - } - [Fact] public void PropertyId_SaveValueAndProperties_WhenSet() { @@ -71,19 +57,5 @@ public void PropertyId_SaveValueAndProperties_WhenSet() Assert.Equal(propertyId, dataSourceItem.PropertyId); Assert.Equal(propertyId, dataSourceItem.Properties.GetValue("PropertyId")); } - - [Fact] - public void PropertyId_ThrowsException_WhenSetToNull() - { - // Arrange - var dataSource = new GoogleAnalytics4DataSource(); - var dataSourceItem = new GoogleAnalytics4DataSourceItem("Test", dataSource); - - // Act - Action act = () => dataSourceItem.PropertyId = null; - - // Assert - Assert.Throws(act); - } } } From 851d87999d15adace91d05b9d622f67a51462ef4 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 13 Nov 2024 18:10:39 +0700 Subject: [PATCH 5/9] add BigQuery ds and ds item tests --- .../GoogleBigQueryDataSourceItemFixture.cs | 61 +++++++++++++++++++ .../GoogleAnalytics4DataSourceFixture.cs | 2 +- .../GoogleBigQueryDataSourceFixture.cs | 39 ++++++++++++ 3 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleBigQueryDataSourceItemFixture.cs create mode 100644 src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleBigQueryDataSourceFixture.cs diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleBigQueryDataSourceItemFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleBigQueryDataSourceItemFixture.cs new file mode 100644 index 0000000..ea7e0b8 --- /dev/null +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleBigQueryDataSourceItemFixture.cs @@ -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("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("ProjectId")); + } + } +} diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleAnalytics4DataSourceFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleAnalytics4DataSourceFixture.cs index 2943c1b..76d7989 100644 --- a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleAnalytics4DataSourceFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleAnalytics4DataSourceFixture.cs @@ -6,7 +6,7 @@ namespace Reveal.Sdk.Dom.Tests.Data.DataSources public class GoogleAnalytics4DataSourceFixture { [Fact] - public void Constructor_SetProvider_ToMicrosoftSqlServer() + public void Constructor_SetProviderToGoogleAnalytics4_WhenConstructed() { // Act var dataSource = new GoogleAnalytics4DataSource(); diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleBigQueryDataSourceFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleBigQueryDataSourceFixture.cs new file mode 100644 index 0000000..49352f0 --- /dev/null +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleBigQueryDataSourceFixture.cs @@ -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("ProjectId")); + } + } +} From 613712116584bb41d5c0940635307259a54a1f5c Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 13 Nov 2024 18:20:17 +0700 Subject: [PATCH 6/9] add google drive ds test --- .../GoogleDriveDataSourceItemFixture.cs | 45 +++++++++++++++++++ .../GoogleDriveDataSourceFixture.cs | 24 ++++++++++ 2 files changed, 69 insertions(+) create mode 100644 src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleDriveDataSourceItemFixture.cs create mode 100644 src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleDriveDataSourceFixture.cs diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleDriveDataSourceItemFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleDriveDataSourceItemFixture.cs new file mode 100644 index 0000000..1e0d645 --- /dev/null +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleDriveDataSourceItemFixture.cs @@ -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("Identitifer")); + } + } +} diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleDriveDataSourceFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleDriveDataSourceFixture.cs new file mode 100644 index 0000000..c07cf9d --- /dev/null +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleDriveDataSourceFixture.cs @@ -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); + } + } +} From 4ced628fd7151dfde83874e5384de8c4494f5159 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 13 Nov 2024 20:16:36 +0700 Subject: [PATCH 7/9] add google sheet ds and ds item tests --- .../GoogleSheetsDataSourceItemFixture.cs | 99 +++++++++++++++++++ .../GoogleSheetsDataSourceFixture.cs | 24 +++++ 2 files changed, 123 insertions(+) create mode 100644 src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleSheetsDataSourceItemFixture.cs create mode 100644 src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleSheetsDataSourceFixture.cs diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleSheetsDataSourceItemFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleSheetsDataSourceItemFixture.cs new file mode 100644 index 0000000..403e3d4 --- /dev/null +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleSheetsDataSourceItemFixture.cs @@ -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("FirstRowContainsLabels")); + + // Act 1 + dataSourceItem.FirstRowContainsLabels = false; + + // Assert + Assert.False(dataSourceItem.FirstRowContainsLabels); + Assert.False(dataSourceItem.Properties.GetValue("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("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("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("Sheet")); + } + } +} diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleSheetsDataSourceFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleSheetsDataSourceFixture.cs new file mode 100644 index 0000000..381196b --- /dev/null +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleSheetsDataSourceFixture.cs @@ -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 GoogleSheetsDataSourceFixture + { + [Fact] + public void Constructor_SetProviderToGoogleSheets_WhenConstructed() + { + // Act + var dataSource = new GoogleSheetsDataSource(); + + // Assert + Assert.Equal(DataSourceProvider.GoogleSheets, dataSource.Provider); + } + } +} From 7a0806f0325d6d48f91d39599202880273d4f4d1 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 13 Nov 2024 20:39:51 +0700 Subject: [PATCH 8/9] add class type test --- .../GoogleAnalytics4DataSourceItemFixture.cs | 13 +++++++++++++ .../GoogleBigQueryDataSourceItemFixture.cs | 14 ++++++++++++++ .../GoogleDriveDataSourceItemFixture.cs | 13 +++++++++++++ .../GoogleSheetsDataSourceItemFixture.cs | 13 +++++++++++++ .../GoogleAnalytics4DataSourceFixture.cs | 10 ++++++++++ .../DataSources/GoogleBigQueryDataSourceFixture.cs | 10 ++++++++++ .../DataSources/GoogleDriveDataSourceFixture.cs | 10 ++++++++++ .../DataSources/GoogleSheetsDataSourceFixture.cs | 11 +++++++++++ 8 files changed, 94 insertions(+) diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs index 2c6620f..42f2aa9 100644 --- a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs @@ -11,6 +11,19 @@ namespace Reveal.Sdk.Dom.Tests.Data.DataSourceItems { public class GoogleAnalytics4DataSourceItemFixture { + [Fact] + public void GoogleAnalytics4DataSourceItem_IsDataSourceItem_WhenConstructed() + { + // Arrange + var dataSource = new GoogleAnalytics4DataSource(); + + // Act + var dataSourceItem = new GoogleAnalytics4DataSourceItem("Test title", dataSource); + + // Assert + Assert.True(dataSourceItem is DataSourceItem); + } + [Fact] public void Constructor_SetsTitleAndDatasource_AsProvided() { diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleBigQueryDataSourceItemFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleBigQueryDataSourceItemFixture.cs index ea7e0b8..a46f6cf 100644 --- a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleBigQueryDataSourceItemFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleBigQueryDataSourceItemFixture.cs @@ -11,6 +11,20 @@ namespace Reveal.Sdk.Dom.Tests.Data.DataSourceItems { public class GoogleBigQueryDataSourceItemFixture { + + [Fact] + public void GoogleBigQueryDataSourceItem_IsDataSourceItem_WhenConstructed() + { + // Arrange + var dataSource = new GoogleBigQueryDataSource(); + + // Act + var dataSourceItem = new GoogleBigQueryDataSourceItem("Test title", dataSource); + + // Assert + Assert.True(dataSourceItem is DataSourceItem); + } + [Fact] public void Constructor_SetsTitleAndDatasource_AsProvided() { diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleDriveDataSourceItemFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleDriveDataSourceItemFixture.cs index 1e0d645..37e9900 100644 --- a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleDriveDataSourceItemFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleDriveDataSourceItemFixture.cs @@ -11,6 +11,19 @@ namespace Reveal.Sdk.Dom.Tests.Data.DataSourceItems { public class GoogleDriveDataSourceItemFixture { + [Fact] + public void GoogleDriveDataSourceItem_IsDataSourceItem_WhenConstructed() + { + // Arrange + var dataSource = new GoogleDriveDataSource(); + + // Act + var dataSourceItem = new GoogleDriveDataSourceItem("Test title", dataSource); + + // Assert + Assert.True(dataSourceItem is DataSourceItem); + } + [Fact] public void Constructor_SetsTitleAndDatasource_AsProvided() { diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleSheetsDataSourceItemFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleSheetsDataSourceItemFixture.cs index 403e3d4..be3f2b4 100644 --- a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleSheetsDataSourceItemFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleSheetsDataSourceItemFixture.cs @@ -11,6 +11,19 @@ namespace Reveal.Sdk.Dom.Tests.Data.DataSourceItems { public class GoogleSheetsDataSourceItemFixture { + [Fact] + public void GoogleSheetsDataSourceItem_IsDataSourceItem_WhenConstructed() + { + // Arrange + var dataSource = new GoogleSheetsDataSource(); + + // Act + var dataSourceItem = new GoogleSheetsDataSourceItem("Test title", dataSource); + + // Assert + Assert.True(dataSourceItem is DataSourceItem); + } + [Fact] public void Constructor_SetsTitleAndDatasource_AsProvided() { diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleAnalytics4DataSourceFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleAnalytics4DataSourceFixture.cs index 76d7989..d89bfee 100644 --- a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleAnalytics4DataSourceFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleAnalytics4DataSourceFixture.cs @@ -5,6 +5,16 @@ namespace Reveal.Sdk.Dom.Tests.Data.DataSources { public class GoogleAnalytics4DataSourceFixture { + [Fact] + public void GoogleAnalytics4DataSource_IsDataSource_WhenConstructed() + { + // Act + var dataSource = new GoogleAnalytics4DataSource(); + + // Assert + Assert.True(dataSource is DataSource); + } + [Fact] public void Constructor_SetProviderToGoogleAnalytics4_WhenConstructed() { diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleBigQueryDataSourceFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleBigQueryDataSourceFixture.cs index 49352f0..836e7b2 100644 --- a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleBigQueryDataSourceFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleBigQueryDataSourceFixture.cs @@ -11,6 +11,16 @@ namespace Reveal.Sdk.Dom.Tests.Data.DataSources { public class GoogleBigQueryDataSourceFixture { + [Fact] + public void GoogleBigQueryDataSource_IsDataSource_WhenConstructed() + { + // Act + var dataSource = new GoogleBigQueryDataSource(); + + // Assert + Assert.True(dataSource is DataSource); + } + [Fact] public void Constructor_SetProviderToGoogleBigQuery_WhenConstructed() { diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleDriveDataSourceFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleDriveDataSourceFixture.cs index c07cf9d..aa0e091 100644 --- a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleDriveDataSourceFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleDriveDataSourceFixture.cs @@ -11,6 +11,16 @@ namespace Reveal.Sdk.Dom.Tests.Data.DataSources { public class GoogleDriveDataSourceFixture { + [Fact] + public void GoogleDriveDataSource_IsDataSource_WhenConstructed() + { + // Act + var dataSource = new GoogleDriveDataSource(); + + // Assert + Assert.True(dataSource is DataSource); + } + [Fact] public void Constructor_SetProviderToGoogleDrive_WhenConstructed() { diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleSheetsDataSourceFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleSheetsDataSourceFixture.cs index 381196b..03a04c0 100644 --- a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleSheetsDataSourceFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleSheetsDataSourceFixture.cs @@ -11,6 +11,17 @@ namespace Reveal.Sdk.Dom.Tests.Data.DataSources { public class GoogleSheetsDataSourceFixture { + + [Fact] + public void GoogleSheetsDataSource_IsDataSource_WhenConstructed() + { + // Act + var dataSource = new GoogleSheetsDataSource(); + + // Assert + Assert.True(dataSource is DataSource); + } + [Fact] public void Constructor_SetProviderToGoogleSheets_WhenConstructed() { From e1d4c7cccf0b5467317f365da9b77c031f7a9129 Mon Sep 17 00:00:00 2001 From: henry Date: Thu, 14 Nov 2024 14:20:08 +0700 Subject: [PATCH 9/9] rm unneded test --- .../GoogleAnalytics4DataSourceItemFixture.cs | 13 ------------- .../GoogleBigQueryDataSourceItemFixture.cs | 14 -------------- .../GoogleDriveDataSourceItemFixture.cs | 13 ------------- .../GoogleSheetsDataSourceItemFixture.cs | 13 ------------- .../GoogleAnalytics4DataSourceFixture.cs | 10 ---------- .../DataSources/GoogleBigQueryDataSourceFixture.cs | 10 ---------- .../DataSources/GoogleDriveDataSourceFixture.cs | 10 ---------- .../DataSources/GoogleSheetsDataSourceFixture.cs | 10 ---------- 8 files changed, 93 deletions(-) diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs index 42f2aa9..2c6620f 100644 --- a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleAnalytics4DataSourceItemFixture.cs @@ -11,19 +11,6 @@ namespace Reveal.Sdk.Dom.Tests.Data.DataSourceItems { public class GoogleAnalytics4DataSourceItemFixture { - [Fact] - public void GoogleAnalytics4DataSourceItem_IsDataSourceItem_WhenConstructed() - { - // Arrange - var dataSource = new GoogleAnalytics4DataSource(); - - // Act - var dataSourceItem = new GoogleAnalytics4DataSourceItem("Test title", dataSource); - - // Assert - Assert.True(dataSourceItem is DataSourceItem); - } - [Fact] public void Constructor_SetsTitleAndDatasource_AsProvided() { diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleBigQueryDataSourceItemFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleBigQueryDataSourceItemFixture.cs index a46f6cf..ea7e0b8 100644 --- a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleBigQueryDataSourceItemFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleBigQueryDataSourceItemFixture.cs @@ -11,20 +11,6 @@ namespace Reveal.Sdk.Dom.Tests.Data.DataSourceItems { public class GoogleBigQueryDataSourceItemFixture { - - [Fact] - public void GoogleBigQueryDataSourceItem_IsDataSourceItem_WhenConstructed() - { - // Arrange - var dataSource = new GoogleBigQueryDataSource(); - - // Act - var dataSourceItem = new GoogleBigQueryDataSourceItem("Test title", dataSource); - - // Assert - Assert.True(dataSourceItem is DataSourceItem); - } - [Fact] public void Constructor_SetsTitleAndDatasource_AsProvided() { diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleDriveDataSourceItemFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleDriveDataSourceItemFixture.cs index 37e9900..1e0d645 100644 --- a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleDriveDataSourceItemFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleDriveDataSourceItemFixture.cs @@ -11,19 +11,6 @@ namespace Reveal.Sdk.Dom.Tests.Data.DataSourceItems { public class GoogleDriveDataSourceItemFixture { - [Fact] - public void GoogleDriveDataSourceItem_IsDataSourceItem_WhenConstructed() - { - // Arrange - var dataSource = new GoogleDriveDataSource(); - - // Act - var dataSourceItem = new GoogleDriveDataSourceItem("Test title", dataSource); - - // Assert - Assert.True(dataSourceItem is DataSourceItem); - } - [Fact] public void Constructor_SetsTitleAndDatasource_AsProvided() { diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleSheetsDataSourceItemFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleSheetsDataSourceItemFixture.cs index be3f2b4..403e3d4 100644 --- a/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleSheetsDataSourceItemFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSourceItems/GoogleSheetsDataSourceItemFixture.cs @@ -11,19 +11,6 @@ namespace Reveal.Sdk.Dom.Tests.Data.DataSourceItems { public class GoogleSheetsDataSourceItemFixture { - [Fact] - public void GoogleSheetsDataSourceItem_IsDataSourceItem_WhenConstructed() - { - // Arrange - var dataSource = new GoogleSheetsDataSource(); - - // Act - var dataSourceItem = new GoogleSheetsDataSourceItem("Test title", dataSource); - - // Assert - Assert.True(dataSourceItem is DataSourceItem); - } - [Fact] public void Constructor_SetsTitleAndDatasource_AsProvided() { diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleAnalytics4DataSourceFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleAnalytics4DataSourceFixture.cs index d89bfee..76d7989 100644 --- a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleAnalytics4DataSourceFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleAnalytics4DataSourceFixture.cs @@ -5,16 +5,6 @@ namespace Reveal.Sdk.Dom.Tests.Data.DataSources { public class GoogleAnalytics4DataSourceFixture { - [Fact] - public void GoogleAnalytics4DataSource_IsDataSource_WhenConstructed() - { - // Act - var dataSource = new GoogleAnalytics4DataSource(); - - // Assert - Assert.True(dataSource is DataSource); - } - [Fact] public void Constructor_SetProviderToGoogleAnalytics4_WhenConstructed() { diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleBigQueryDataSourceFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleBigQueryDataSourceFixture.cs index 836e7b2..49352f0 100644 --- a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleBigQueryDataSourceFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleBigQueryDataSourceFixture.cs @@ -11,16 +11,6 @@ namespace Reveal.Sdk.Dom.Tests.Data.DataSources { public class GoogleBigQueryDataSourceFixture { - [Fact] - public void GoogleBigQueryDataSource_IsDataSource_WhenConstructed() - { - // Act - var dataSource = new GoogleBigQueryDataSource(); - - // Assert - Assert.True(dataSource is DataSource); - } - [Fact] public void Constructor_SetProviderToGoogleBigQuery_WhenConstructed() { diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleDriveDataSourceFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleDriveDataSourceFixture.cs index aa0e091..c07cf9d 100644 --- a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleDriveDataSourceFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleDriveDataSourceFixture.cs @@ -11,16 +11,6 @@ namespace Reveal.Sdk.Dom.Tests.Data.DataSources { public class GoogleDriveDataSourceFixture { - [Fact] - public void GoogleDriveDataSource_IsDataSource_WhenConstructed() - { - // Act - var dataSource = new GoogleDriveDataSource(); - - // Assert - Assert.True(dataSource is DataSource); - } - [Fact] public void Constructor_SetProviderToGoogleDrive_WhenConstructed() { diff --git a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleSheetsDataSourceFixture.cs b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleSheetsDataSourceFixture.cs index 03a04c0..d4d5f08 100644 --- a/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleSheetsDataSourceFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/Data/DataSources/GoogleSheetsDataSourceFixture.cs @@ -12,16 +12,6 @@ namespace Reveal.Sdk.Dom.Tests.Data.DataSources public class GoogleSheetsDataSourceFixture { - [Fact] - public void GoogleSheetsDataSource_IsDataSource_WhenConstructed() - { - // Act - var dataSource = new GoogleSheetsDataSource(); - - // Assert - Assert.True(dataSource is DataSource); - } - [Fact] public void Constructor_SetProviderToGoogleSheets_WhenConstructed() {