Skip to content

Commit

Permalink
fix the UT name and create RestItem
Browse files Browse the repository at this point in the history
  • Loading branch information
recca5p committed Dec 11, 2024
1 parent 53fd444 commit 61256a2
Showing 1 changed file with 43 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -426,58 +426,62 @@ public void RDashDocument_HasCorrectDataSourceItem_WhenLoadFromFile()
}

[Fact]
public void ToJsonString_CreatesFormattedJson_ForWebServiceDataSource()
public void ToJsonString_CreatesFormattedJson_ForRestDataSource()
{
// Arrange
var expectedJson = @"
{
""_type"": ""DataSourceItemType"",
""Id"": ""RestItem"",
""Title"": ""Rest DS Item"",
""DataSourceId"": ""__JSON"",
""HasTabularData"": true,
""HasAsset"": false,
""Properties"": {},
""Parameters"": {
""config"": {
""iterationDepth"": 0,
""columnsConfig"": [
{
""key"": ""_id"",
""type"": 0
},
{
""key"": ""name"",
""type"": 0
var expectedJson =
"""
{
"_type": "DataSourceItemType",
"Id": "RestItem",
"Title": "Rest DS Item",
"DataSourceId": "__JSON",
"HasTabularData": true,
"HasAsset": false,
"Properties": {},
"Parameters": {
"config": {
"iterationDepth": 0,
"columnsConfig": [
{
"key": "_id",
"type": 0
},
{
"key": "name",
"type": 0
}
]
}
]
},
"ResourceItem": {
"_type": "DataSourceItemType",
"Id": "RestItem",
"Title": "DB Test",
"DataSourceId": "Json",
"HasTabularData": true,
"HasAsset": false,
"Properties": {
"Url": "https://excel2json.io/api/share/6e0f06b3-72d3-4fec-7984-08da43f56bb9"
},
"Parameters": {}
}
}
},
""ResourceItem"": {
""_type"": ""DataSourceItemType"",
""Id"": ""RestItem"",
""Title"": ""DB Test"",
""DataSourceId"": ""Rest"",
""HasTabularData"": true,
""HasAsset"": false,
""Properties"": {},
""Parameters"": {}
}
}";

var dataSource = new RestDataSource()
""";

var dataSource = new DataSource()
{
Id = "Rest",
Title = "Rest DS",
Id = "Json",
Title = "Json DS",
DefaultRefreshRate = "120",
Url = "https://excel2json.io/api/share/6e0f06b3-72d3-4fec-7984-08da43f56bb9",
Subtitle = "Excel2Json"
};

var dataSourceItems = new RestDataSourceItem("DB Test", dataSource)
{
Id = "RestItem",
Title = "Rest DS Item",
Uri = "https://excel2json.io/api/share/6e0f06b3-72d3-4fec-7984-08da43f56bb9",
Fields = new List<IField>
{
new TextField("_id"),
Expand Down

0 comments on commit 61256a2

Please sign in to comment.