-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Styling changes and SDS mapping (#14)
Add tests for report server. Fixed shared datasource mapping. Applied suggested style.
- Loading branch information
Showing
17 changed files
with
523 additions
and
383 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,81 @@ | ||
// Copyright (c) 2019 Microsoft Corporation. All Rights Reserved. | ||
// Licensed under the MIT License (MIT) | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Threading; | ||
using Microsoft.PowerBI.Api.V2; | ||
using Microsoft.PowerBI.Api.V2.Models; | ||
using Microsoft.Rest; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Moq; | ||
using RdlMigration.ReportServerApi; | ||
|
||
namespace RdlMigration.UnitTest | ||
{ | ||
[TestClass] | ||
public class RdlFileIOTests | ||
{ | ||
[TestMethod] | ||
public void TestFromServer_SharedDataSourceNamesAreKept() | ||
{ | ||
var mockServer = new Mock<IReportingService2010>(); | ||
var mockDataSource = new ItemReferenceData | ||
{ | ||
Name = "DataSource1", | ||
Reference = "/reference/ds1", | ||
ReferenceType = "DataSource" | ||
}; | ||
|
||
mockServer.Setup(p => p.GetItemReferences(It.IsAny<string>(), "DataSource")).Returns(new ItemReferenceData[] { mockDataSource }); | ||
var sut = new RdlFileIO(mockServer.Object); | ||
var references = sut.GetDataSourceReference("path"); | ||
|
||
Assert.AreEqual(1, references.Count); | ||
Assert.AreEqual("DataSource1", references[0].Name); | ||
} | ||
|
||
[TestMethod] | ||
public void TestFromServer_SharedDataSetDataSourceNamesAreRenamed() | ||
{ | ||
var mockServer = new Mock<IReportingService2010>(); | ||
var mockDataSource = new ItemReferenceData | ||
{ | ||
Name = "DataSource1", | ||
Reference = "/reference/ds1", | ||
ReferenceType = "DataSource" | ||
}; | ||
|
||
var mockDataSource2 = new ItemReferenceData | ||
{ | ||
Name = "DataSource2", | ||
Reference = "/reference/ds2", | ||
ReferenceType = "DataSource" | ||
}; | ||
|
||
var mockDataSet = new ItemReferenceData | ||
{ | ||
Name = "Dataset1", | ||
Reference = "/reference/ds2", | ||
ReferenceType = "DataSource" | ||
}; | ||
|
||
mockServer.Setup(p => p.GetItemReferences("/report", "DataSource")) | ||
.Returns(new ItemReferenceData[] { mockDataSource }); | ||
|
||
mockServer.Setup(p => p.GetItemReferences("/reference/ds2", "DataSource")) | ||
.Returns(new ItemReferenceData[] { mockDataSource2 }); | ||
|
||
mockServer.Setup(p => p.GetItemReferences(It.IsAny<string>(), "DataSet")) | ||
.Returns(new ItemReferenceData[] { mockDataSet }); | ||
|
||
var sut = new RdlFileIO(mockServer.Object); | ||
var references = sut.GetDataSourceReference("/report"); | ||
|
||
Assert.AreEqual(2, references.Count); | ||
Assert.AreEqual("DataSource1", references[0].Name); | ||
Assert.IsTrue(references[1].Name.Contains("ds2")); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" /> | ||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/> | ||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0"/> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
</configuration> | ||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration> |
Oops, something went wrong.