-
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 #266 from RevealBi/unit-test/single-gauge-vs-dataspec
Create UTs for SingleGaugeVisualizationDataSpec class
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
...dk.Dom.Tests/Visualizations/VisualizationSpecs/SingleGaugeVisualizationDataSpecFixture.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,50 @@ | ||
using Newtonsoft.Json.Linq; | ||
using Reveal.Sdk.Dom.Core.Constants; | ||
using Reveal.Sdk.Dom.Visualizations; | ||
using Reveal.Sdk.Dom.Visualizations.VisualizationSpecs; | ||
using System.Collections.Generic; | ||
using Xunit; | ||
|
||
namespace Reveal.Sdk.Dom.Tests.Visualizations.VisualizationSpecs | ||
{ | ||
public class SingleGaugeVisualizationDataSpecFixture | ||
{ | ||
[Fact] | ||
public void Constructor_FieldsHaveDefaultValue_WithoutParameters() | ||
{ | ||
// Act | ||
var singleGaugeVSDataSpec = new SingleGaugeVisualizationDataSpec(); | ||
|
||
// Assert | ||
Assert.Equal(SchemaTypeNames.SingleGaugeVisualizationDataSpecType, singleGaugeVSDataSpec.SchemaTypeName); | ||
} | ||
|
||
[Fact] | ||
public void ToJsonString_CreateCorrectJsonString_WithoutCondition() | ||
{ | ||
// Arrange | ||
var expectedJson = """ | ||
{ | ||
"_type": "SingleGaugeVisualizationDataSpecType", | ||
"Label": { | ||
"_type": "DimensionColumnSpecType" | ||
}, | ||
"Value": [] | ||
} | ||
"""; | ||
var singleGaugeVSDataSpec = new SingleGaugeVisualizationDataSpec() | ||
{ | ||
Label = new DimensionColumn(), | ||
Value = new List<MeasureColumn>() | ||
}; | ||
|
||
// Act | ||
var actualJson = singleGaugeVSDataSpec.ToJsonString(); | ||
var expectedJObject = JObject.Parse(expectedJson); | ||
var actualJObject = JObject.Parse(actualJson); | ||
|
||
// Assert | ||
Assert.Equal(expectedJObject, actualJObject); | ||
} | ||
} | ||
} |