-
Notifications
You must be signed in to change notification settings - Fork 521
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e858769
commit 0fb9f80
Showing
7 changed files
with
869 additions
and
7 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/Microsoft.Health.Fhir.SqlServer.UnitTests/IndentedStringBuilderTests.cs
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,36 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. | ||
// ------------------------------------------------------------------------------------------------- | ||
|
||
using System; | ||
using System.Text; | ||
using Xunit; | ||
|
||
namespace Microsoft.Health.Fhir.SqlServer.UnitTests | ||
{ | ||
public class IndentedStringBuilderTests | ||
{ | ||
[Fact] | ||
public void GivenAnIndentedStringBuilder_WhenUsingIndentedScopes_KeepsTrackOfIndentation() | ||
{ | ||
var sb = new IndentedStringBuilder(new StringBuilder()) | ||
.AppendLine("class Foo").AppendLine("{"); | ||
|
||
using (sb.Indent()) | ||
{ | ||
sb.AppendLine("Foo()").AppendLine("{"); | ||
using (sb.Indent()) | ||
{ | ||
sb.Append("// ").AppendLine("hello"); | ||
} | ||
|
||
sb.AppendLine("}"); | ||
} | ||
|
||
sb.Append("}"); | ||
|
||
Assert.Equal($"class Foo{Environment.NewLine}{{{Environment.NewLine} Foo(){Environment.NewLine} {{{Environment.NewLine} // hello{Environment.NewLine} }}{Environment.NewLine}}}", sb.ToString()); | ||
} | ||
} | ||
} |
Oops, something went wrong.