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
SELECT * | |
--This would be your table, rather than a VALUES table construct | |
FROM (VALUES('[{"Name":"Test","Value":"Value"}, {"Name":"Test2","Value":"Value2"}]'), | |
('[{"Name":"Test","Value":"Value"}, {"Name":"Test2","Value":"Value3"}]'), | |
('[{"Name":"Test","Value":null}]'), | |
('[]'))V(YourColumn) | |
WHERE 'Value' in (SELECT Value FROM OpenJson(V.YourColumn) | |
WITH ( | |
Name Nvarchar(max) '$.Name', |
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
SELECT * | |
--This would be your table, rather than a VALUES table construct | |
FROM (VALUES('[{"Name":"Test","Value":"Value"}, {"Name":"Test2","Value":"Value2"}]'), | |
('[{"Name":"Test","Value":"Value"}, {"Name":"Test2","Value":"Value3"}]'), | |
('[{"Name":"Test","Value":null}]'), | |
('[]'))V(YourColumn) | |
WHERE 'Value' in (SELECT Value FROM OpenJson(V.YourColumn) | |
WITH ( | |
Name Nvarchar(max) '$.Name', |
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
public TestedObject CreateSut(IDependency dep = null, IDependency2 dep2 = null) | |
{ | |
return new TestedObject( | |
dep ?? Mock.Of<IDependency>(), | |
dep2 ?? Mock.Of<IDependency2>()); | |
} |
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
[Test] | |
public void It_works_with_another_dependency() | |
{ | |
var dependency2 = new Mock<IDependency2>(); | |
// dependency setup | |
var sut = CreateSut(dep2: dependency2.Object); | |
var result = testedObject.WorkWithDependency(); | |
// assert result | |
dependency.Verify(d => d.WasNotified()); | |
} |
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
public TestedObject CreateSut(IDependency dep = null, IDependency2 dep2 = null) | |
{ | |
return new TestedObject( | |
dep ?? Mock.Of<IDependency>(), | |
dep2 ?? Mock.Of<IDependency2>()); | |
} |
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
[Test] | |
public void It_works_with_another_dependency() | |
{ | |
var dependency2 = new Mock(); | |
// dependency setup | |
var sut = CreateSut(dep2: dependency2.Object); | |
var result = testedObject.WorkWithDependency(); | |
// assert result | |
dependency.Verify(d => d.WasNotified()); | |
} |
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
public TestedObject CreateSut(IDependency dependency = null) | |
{ | |
return new TestedObject(depency); | |
} |
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
[Test] | |
public void It_works_with_dependencies() | |
{ | |
var dependency = new Mock<IDependency>(); | |
// dependency setup | |
var sut = CreateSut(dependency.Object); | |
var result = testedObject.WorkWithDependency(); | |
// assert result | |
dependency.Verify(d => d.WasNotified()); | |
} |
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
public TestedObject CreateSut() | |
{ | |
return new TestedObject(); | |
} | |
[Test] | |
public void It_does_this() | |
{ | |
var sut = CreateSut(); | |
var result = sut.DoThis(); |
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
private TestedObject testedObject; | |
private IDependency depency; | |
[SetUp] | |
public void Setup() | |
{ | |
var dependency = new Mock<IDependency>(); | |
// dependency setup | |
testedObject = new TestedObject(depency.object); | |
} |
NewerOlder