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
using System; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
using ApprovalTests; | |
using ApprovalTests.Reporters; | |
using ApprovalUtilities.Persistence; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
using ObjectApproval; | |
/** |
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 EnsureNoAbandonedFiles() | |
{ | |
ApprovalMaintenance.VerifyNoAbandonedFiles(); | |
} |
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 TestInternationalization() | |
{ | |
AspApprovals.VerifyUrl("http://localhost:1359/OrderForm", ScrubAspViewstate); | |
} | |
public static string ScrubAspViewstate(string input) | |
{ | |
string AspViewState = "<input type=\"hidden\" name=\"__VIEWSTATE\".+/>"; |
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 void MyMethod() | |
{ | |
using (Logger.MarkEntryPoints()) | |
{ | |
if (guardClauss){return ;} | |
// other logic | |
} | |
} | |
Will produce |
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 void TestVerifyCircleReferences() | |
{ | |
StatePrinterApprovals.Verify(anyObject); | |
} | |
Can produce output like | |
Root = <Turtle>, ref: 0 | |
{ | |
Name = "jim" |
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 TestGoogleQuery() | |
{ | |
Approvals.Verify(new GoogleQuery("lolcats")); | |
} | |
// Make sure your RestCall extends RestQuery<T> where T is what is returned from the call | |
class GoogleQuery : RestQuery<GoogleQueryResults> |
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
Approvals.VerifyJson(jsonText); | |
///Produces | |
{ | |
"GivenNames": "John", | |
"FamilyName": "Smith", | |
"Spouse": "Jill", | |
"Address": { | |
"Street": "1 Puddle Lane", |
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
SerializableTheory.Verify(anyObject, Assert.AreEqual); |
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
WindowsRegistryAssert.HasDword(keyName: "Console", valueName:"TrimLeadingZeros", expectedValue:0,failureMessage: "You should probably Have This"); |
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] | |
[TestCase("foo", "bar")] | |
[TestCase("jack", "jill")] | |
public void Transformer(string a, string b) | |
{ | |
using (ApprovalResults.ForScenario(a,b)) | |
{ | |
Approvals.Verify(Transform(a,b)); | |
} | |
} |
OlderNewer