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

add microsoft UT #83

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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.DataSourceItems
{
public class MicrosoftAzureAnalysisServicesDataSourceItemFixture
{
[Fact]
public void Constructor_SetsTitleAndDatasource_AsProvided()
{
// Arrange
var dataSource = new MicrosoftAzureAnalysisServicesDataSource();
var title = "Test title";

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

// Assert
Assert.Equal(title, dataSourceItem.Title);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use Theory to increase the coverage of unit tests. For ex the commit: https://github.com/RevealBi/Reveal.Sdk.Dom/pull/93/commits/051374207ac976bf40077db08ac82c5c5948b088

The base constructor should also check:

  • Assert.Equal(dataSource.Id, dataSourceItem.DataSourceId);
  • Assert.Equal(expectedDSTitle, dataSourceItem.DataSource.Item);

Assert.Equal(dataSource, dataSourceItem.DataSource);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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.DataSourceItems
{
public class MicrosoftAzureSqlServerDataSourceItemFixture
{
[Fact]
public void Constructor_SetsTitleAndDatasource_AsProvided()
{
// Arrange
var dataSource = new MicrosoftAzureSqlServerDataSource();
var title = "Test title";

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

// Assert
Assert.Equal(title, dataSourceItem.Title);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use Theory to increase the coverage of unit tests. For ex the commit: https://github.com/RevealBi/Reveal.Sdk.Dom/pull/93/commits/051374207ac976bf40077db08ac82c5c5948b088

The base constructor should also check:

  • Assert.Equal(dataSource.Id, dataSourceItem.DataSourceId);
  • Assert.Equal(expectedDSTitle, dataSourceItem.DataSource.Item);

Assert.Equal(dataSource, dataSourceItem.DataSource);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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.DataSourceItems
{
public class MicrosoftAzureSynapseAnalyticsDataSourceItemFixture
{
[Fact]
public void Constructor_SetsTitleAndDatasource_AsProvided()
{
// Arrange
var dataSource = new MicrosoftAzureSynapseAnalyticsDataSource();
var title = "Test title";

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

// Assert
Assert.Equal(title, dataSourceItem.Title);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use Theory to increase the coverage of unit tests. For ex the commit: https://github.com/RevealBi/Reveal.Sdk.Dom/pull/93/commits/051374207ac976bf40077db08ac82c5c5948b088

The base constructor should also check:

  • Assert.Equal(dataSource.Id, dataSourceItem.DataSourceId);
  • Assert.Equal(expectedDSTitle, dataSourceItem.DataSource.Item);

Assert.Equal(dataSource, dataSourceItem.DataSource);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
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.DataSourceItems
{
public class MicrosoftOneDriveDataSourceItemFixture
{

[Fact]
public void Constructor_SetsTitleAndDatasource_AsProvided()
{
// Arrange
var dataSource = new MicrosoftOneDriveDataSource();
var title = "Test title";

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

// Assert
Assert.Equal(title, dataSourceItem.Title);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use Theory to increase the coverage of unit tests. For ex the commit: https://github.com/RevealBi/Reveal.Sdk.Dom/pull/93/commits/051374207ac976bf40077db08ac82c5c5948b088

The base constructor should also check:

  • Assert.Equal(dataSource.Id, dataSourceItem.DataSourceId);
  • Assert.Equal(expectedDSTitle, dataSourceItem.DataSource.Item);

Assert.Equal(dataSource, dataSourceItem.DataSource);
}

[Fact]
public void Identifier_SaveValueAndProperties_WhenSet()
{
// Arrange
var dataSource = new MicrosoftOneDriveDataSource();
var dataSourceItem = new MicrosoftOneDriveDataSourceItem("Test", dataSource);
var identifier = "Identifier";

// Act
dataSourceItem.Identifier = identifier;

// Assert
Assert.Equal(identifier, dataSourceItem.Identifier);
Assert.Equal(identifier, dataSourceItem.Properties.GetValue<string>("Identifier"));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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.DataSourceItems
{
public class MicrosoftSharePointDataSourceItemFixture
{
[Fact]
public void Constructor_SetsTitleAndDatasource_AsProvided()
{
// Arrange
var dataSource = new MicrosoftSharePointDataSource();
var title = "Test title";

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

// Assert
Assert.Equal(title, dataSourceItem.Title);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use Theory to increase the coverage of unit tests. For ex the commit: https://github.com/RevealBi/Reveal.Sdk.Dom/pull/93/commits/051374207ac976bf40077db08ac82c5c5948b088

The base constructor should also check:

  • Assert.Equal(dataSource.Id, dataSourceItem.DataSourceId);
  • Assert.Equal(expectedDSTitle, dataSourceItem.DataSource.Item);

Assert.Equal(dataSource, dataSourceItem.DataSource);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using Reveal.Sdk.Dom.Core.Extensions;
using Reveal.Sdk.Dom.Data;
using Xunit;

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

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

[Fact]
public void Catalog_SaveValueAndProperties_WhenSet()
{
// Arrange
var dataSource = new MicrosoftAnalysisServicesDataSource();
var catalog = "TestCatalog";

// Act
dataSource.Catalog = catalog;

// Assert
Assert.Equal(catalog, dataSource.Catalog);
Assert.Equal(catalog, dataSource.Properties.GetValue<string>("Catalog"));
}

[Fact]
public void Host_SaveValueAndProperties_WhenSet()
{
// Arrange
var dataSource = new MicrosoftAnalysisServicesDataSource();
var host = "TestHost";

// Act
dataSource.Host = host;

// Assert
Assert.Equal(host, dataSource.Host);
Assert.Equal(host, dataSource.Properties.GetValue<string>("Host"));
}

[Fact]
public void Port_SaveValueAndProperties_WhenSet()
{
// Arrange
var dataSource = new MicrosoftAnalysisServicesDataSource();
var port = 8123;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should Port be string for consitency in HostDataSource?


// Act
dataSource.Port = port;

// Assert
Assert.Equal(port, dataSource.Port);
Assert.Equal(port, dataSource.Properties.GetValue<int>("Port"));
}
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Reveal.Sdk.Dom.Core.Extensions;
using Reveal.Sdk.Dom.Data;
using Xunit;

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

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

[Fact]
public void ServerUrl_SaveValueAndProperties_WhenSet()
{
// Arrange
var dataSource = new MicrosoftAzureAnalysisServicesDataSource();
var serverUrl = "TestServerUrl";

// Act
dataSource.ServerUrl = serverUrl;

// Assert
Assert.Equal(serverUrl, dataSource.ServerUrl);
Assert.Equal(serverUrl, dataSource.Properties.GetValue<string>("ServerUrl"));
}

}
}
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 MicrosoftAzureSqlServerDataSourceFixture
{
[Fact]
public void Constructor_SetProviderToMicrosoftAzureSqlServer_WhenConstructed()
{
// Act
var dataSource = new MicrosoftAzureSqlServerDataSource();

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

[Fact]
public void TrustServerCertificate_SaveValueAndProperties_WhenSet()
{
// Arrange
var dataSource = new MicrosoftAzureSqlServerDataSource();
var trustServerCertificate = false;

// Act
dataSource.TrustServerCertificate = trustServerCertificate;

// Assert
Assert.Equal(trustServerCertificate, dataSource.TrustServerCertificate);
Assert.Equal(trustServerCertificate, dataSource.Properties.GetValue<bool>("TrustServerCertificate"));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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 MicrosoftAzureSynapseAnalyticsDataSourceFixture
{
[Fact]
public void Constructor_SetProviderToMicrosoftAzureSqlServer_WhenConstructed()
{
// Act
var dataSource = new MicrosoftAzureSynapseAnalyticsDataSource();

// Assert
Assert.Equal(DataSourceProvider.MicrosoftAzureSynapseAnalytics, dataSource.Provider);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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 MicrosoftOneDriveDataSourceFixture
{
[Fact]
public void Constructor_SetProviderToMicrosoftAzureSqlServer_WhenConstructed()
{
// Act
var dataSource = new MicrosoftOneDriveDataSource();

// Assert
Assert.Equal(DataSourceProvider.MicrosoftOneDrive, dataSource.Provider);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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 MicrosoftSharePointDataSourceFixture
{
[Fact]
public void Constructor_SetProviderToMicrosoftAzureSqlServer_WhenConstructed()
{
// Act
var dataSource = new MicrosoftSharePointDataSource();

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