-
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 #52 from RevealBi/dsi-refactor
Added MS Sql Server Data Source object
- Loading branch information
Showing
12 changed files
with
337 additions
and
105 deletions.
There are no files selected for viewing
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
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
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
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
150 changes: 150 additions & 0 deletions
150
src/Reveal.Sdk.Dom.Tests/Data/MicrosoftSqlServerDataSourceFixture.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,150 @@ | ||
using Reveal.Sdk.Dom.Core.Extensions; | ||
using Reveal.Sdk.Dom.Data; | ||
using Xunit; | ||
|
||
namespace Reveal.Sdk.Dom.Tests.Data | ||
{ | ||
public class MicrosoftSqlServerDataSourceFixture | ||
{ | ||
[Fact] | ||
public void Constructor_Should_SetProviderToMicrosoftSqlServer() | ||
{ | ||
// Arrange | ||
var dataSource = new MicrosoftSqlServerDataSource(); | ||
|
||
// Act | ||
var provider = dataSource.Provider; | ||
|
||
// Assert | ||
Assert.Equal(DataSourceProvider.MicrosoftSqlServer, provider); | ||
} | ||
|
||
[Fact] | ||
public void Constructor_Should_SetServerAggregationDefaultToTrue() | ||
{ | ||
// Arrange | ||
var dataSource = new MicrosoftSqlServerDataSource(); | ||
|
||
// Act | ||
var serverAggregationDefault = dataSource.Properties.GetValue<bool>("ServerAggregationDefault"); | ||
|
||
// Assert | ||
Assert.True(serverAggregationDefault); | ||
} | ||
|
||
[Fact] | ||
public void Constructor_Should_SetServerAggregationReadOnlyToFalse() | ||
{ | ||
// Arrange | ||
var dataSource = new MicrosoftSqlServerDataSource(); | ||
|
||
// Act | ||
var serverAggregationReadOnly = dataSource.Properties.GetValue<bool>("ServerAggregationReadOnly"); | ||
|
||
// Assert | ||
Assert.False(serverAggregationReadOnly); | ||
} | ||
|
||
[Fact] | ||
public void Database_Should_GetAndSetDatabaseProperty() | ||
{ | ||
// Arrange | ||
var dataSource = new MicrosoftSqlServerDataSource(); | ||
var database = "TestDatabase"; | ||
|
||
// Act | ||
dataSource.Database = database; | ||
var result = dataSource.Database; | ||
|
||
// Assert | ||
Assert.Equal(database, result); | ||
} | ||
|
||
[Fact] | ||
public void Host_Should_GetAndSetHostProperty() | ||
{ | ||
// Arrange | ||
var dataSource = new MicrosoftSqlServerDataSource(); | ||
var host = "TestHost"; | ||
|
||
// Act | ||
dataSource.Host = host; | ||
var result = dataSource.Host; | ||
|
||
// Assert | ||
Assert.Equal(host, result); | ||
} | ||
|
||
[Fact] | ||
public void Port_Should_GetAndSetPortProperty() | ||
{ | ||
// Arrange | ||
var dataSource = new MicrosoftSqlServerDataSource(); | ||
var port = "1234"; | ||
|
||
// Act | ||
dataSource.Port = port; | ||
var result = dataSource.Port; | ||
|
||
// Assert | ||
Assert.Equal(port, result); | ||
} | ||
|
||
[Fact] | ||
public void Schema_Should_GetAndSetSchemaProperty() | ||
{ | ||
// Arrange | ||
var dataSource = new MicrosoftSqlServerDataSource(); | ||
var schema = "TestSchema"; | ||
|
||
// Act | ||
dataSource.Schema = schema; | ||
var result = dataSource.Schema; | ||
|
||
// Assert | ||
Assert.Equal(schema, result); | ||
} | ||
|
||
[Fact] | ||
public void Create_Should_CreateNewMicrosoftSqlServerDataSourceWithMatchingProperties() | ||
{ | ||
// Arrange | ||
var dataSource = new DataSource() | ||
{ | ||
Id = "1", | ||
Title = "Test Title", | ||
Subtitle = "Test Subtitle" | ||
}; | ||
|
||
// Act | ||
var result = MicrosoftSqlServerDataSource.Create(dataSource); | ||
|
||
// Assert | ||
Assert.Equal(dataSource.Id, result.Id); | ||
Assert.Equal(dataSource.Title, result.Title); | ||
Assert.Equal(dataSource.Subtitle, result.Subtitle); | ||
} | ||
|
||
[Fact] | ||
public void Constructor_Should_Set_ServerAggregationDefault_Property() | ||
{ | ||
// Arrange | ||
var dataSource = new MicrosoftSqlServerDataSource(); | ||
|
||
// Assert | ||
Assert.True(dataSource.Properties.ContainsKey("ServerAggregationDefault")); | ||
Assert.True(dataSource.Properties.GetValue<bool>("ServerAggregationDefault")); | ||
} | ||
|
||
[Fact] | ||
public void Constructor_Should_Set_ServerAggregationReadOnly_Property() | ||
{ | ||
// Arrange | ||
var dataSource = new MicrosoftSqlServerDataSource(); | ||
|
||
// Assert | ||
Assert.True(dataSource.Properties.ContainsKey("ServerAggregationReadOnly")); | ||
Assert.False(dataSource.Properties.GetValue<bool>("ServerAggregationReadOnly")); | ||
} | ||
} | ||
} |
Oops, something went wrong.