This repository has been archived by the owner on Sep 25, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ignoring duplicate tests in deploy scripts
- Loading branch information
Showing
9 changed files
with
123 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using AgileSQLClub.tSQLtTestController; | ||
using Moq; | ||
using NUnit.Framework; | ||
using tSQLtTestAdapter; | ||
|
||
namespace UnitTests | ||
{ | ||
[TestFixture] | ||
public class TestCacheTests | ||
{ | ||
[Test] | ||
public void DiscardsDuplicates() | ||
{ | ||
var mockScanner = new Mock<FileScanner>(); | ||
|
||
mockScanner.Setup(p => p.ScanCode(It.IsAny<string>(), It.IsAny<ScanResults>(), It.IsAny<string>())).Returns(( | ||
string a, ScanResults result, string b) => | ||
{ | ||
result.FoundClasses.Add(new SqlSchema("Schema", "PathA")); | ||
result.FoundClasses.Add(new SqlSchema("Schema", "PathB")); | ||
result.FoundClasses.Add(new SqlSchema("Schema", "PathB")); | ||
|
||
result.FoundPotentialTests.Add(new SqlProcedure(new SqlObjectName() {Object = "test", Schema = "Schema"}, "Patha", 0, 100, 1)); | ||
result.FoundPotentialTests.Add(new SqlProcedure(new SqlObjectName() { Object = "test", Schema = "Schema" }, "Pathb", 0, 100, 1)); | ||
return result; | ||
}); | ||
|
||
var mockFileReader = new Mock<IFileReader>(); | ||
mockFileReader.Setup(p => p.ReadAll(It.IsAny<string>())).Returns("Blah"); | ||
mockFileReader.Setup(p => p.GetLastWriteTimeUtc(It.IsAny<string>())).Returns(DateTime.MaxValue); | ||
|
||
var testCache = new TestCache(mockScanner.Object, mockFileReader.Object); | ||
testCache.AddPath("path"); | ||
Assert.AreEqual(1, testCache.GetTests().Count); | ||
} | ||
} | ||
} |
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,5 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Castle.Core" version="4.0.0" targetFramework="net452" /> | ||
<package id="Microsoft.SqlServer.DacFx.x64" version="130.3411.1" targetFramework="net452" /> | ||
<package id="Moq" version="4.7.1" targetFramework="net452" /> | ||
<package id="NUnit" version="3.2.1" targetFramework="net452" /> | ||
</packages> |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
|
||
namespace tSQLtTestAdapter | ||
{ | ||
public interface IFileReader | ||
{ | ||
DateTime GetLastWriteTimeUtc(string path); | ||
string ReadAll(string path); | ||
} | ||
} |
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