diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-04-27 22:37:33 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-04-27 22:37:33 -0700 |
| commit | 612dc390ecd90bf4079ad7545f4a4832ce8f702d (patch) | |
| tree | d027ac1e327ef78c83b722ab28e293a6bbeb7a78 /src/test/WixToolsetTest.Converters/FormatFixture.cs | |
| parent | 0177cb5b9b08351266816097ea9e8561b9ec0973 (diff) | |
| download | wix-612dc390ecd90bf4079ad7545f4a4832ce8f702d.tar.gz wix-612dc390ecd90bf4079ad7545f4a4832ce8f702d.tar.bz2 wix-612dc390ecd90bf4079ad7545f4a4832ce8f702d.zip | |
Move Converters into wix
Diffstat (limited to 'src/test/WixToolsetTest.Converters/FormatFixture.cs')
| -rw-r--r-- | src/test/WixToolsetTest.Converters/FormatFixture.cs | 117 |
1 files changed, 0 insertions, 117 deletions
diff --git a/src/test/WixToolsetTest.Converters/FormatFixture.cs b/src/test/WixToolsetTest.Converters/FormatFixture.cs deleted file mode 100644 index 739fba66..00000000 --- a/src/test/WixToolsetTest.Converters/FormatFixture.cs +++ /dev/null | |||
| @@ -1,117 +0,0 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolsetTest.Converters | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Xml.Linq; | ||
| 7 | using WixToolset.Converters; | ||
| 8 | using WixToolsetTest.Converters.Mocks; | ||
| 9 | using Xunit; | ||
| 10 | |||
| 11 | public class FormatFixture : BaseConverterFixture | ||
| 12 | { | ||
| 13 | [Fact] | ||
| 14 | public void CanFixWhitespace() | ||
| 15 | { | ||
| 16 | var parse = String.Join(Environment.NewLine, | ||
| 17 | "<?xml version='1.0' encoding='utf-8'?>", | ||
| 18 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
| 19 | " <Fragment>", | ||
| 20 | " <Property Id='Prop'", | ||
| 21 | " Value='Val'>", | ||
| 22 | " </Property>", | ||
| 23 | " </Fragment>", | ||
| 24 | "</Wix>"); | ||
| 25 | |||
| 26 | var expected = String.Join(Environment.NewLine, | ||
| 27 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
| 28 | " <Fragment>", | ||
| 29 | " <Property Id=\"Prop\" Value=\"Val\" />", | ||
| 30 | " </Fragment>", | ||
| 31 | "</Wix>"); | ||
| 32 | |||
| 33 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
| 34 | |||
| 35 | var messaging = new MockMessaging(); | ||
| 36 | var converter = new WixConverter(messaging, 4, null, null); | ||
| 37 | |||
| 38 | var errors = converter.FormatDocument(document); | ||
| 39 | |||
| 40 | var actual = UnformattedDocumentString(document); | ||
| 41 | |||
| 42 | Assert.Equal(expected, actual); | ||
| 43 | Assert.Equal(5, errors); | ||
| 44 | } | ||
| 45 | |||
| 46 | [Fact] | ||
| 47 | public void CanPreserveNewLines() | ||
| 48 | { | ||
| 49 | var parse = String.Join(Environment.NewLine, | ||
| 50 | "<?xml version='1.0' encoding='utf-8'?>", | ||
| 51 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
| 52 | " <Fragment>", | ||
| 53 | "", | ||
| 54 | " <Property Id='Prop' Value='Val' />", | ||
| 55 | "", | ||
| 56 | " </Fragment>", | ||
| 57 | "</Wix>"); | ||
| 58 | |||
| 59 | var expected = String.Join(Environment.NewLine, | ||
| 60 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
| 61 | " <Fragment>", | ||
| 62 | "", | ||
| 63 | " <Property Id=\"Prop\" Value=\"Val\" />", | ||
| 64 | "", | ||
| 65 | " </Fragment>", | ||
| 66 | "</Wix>"); | ||
| 67 | |||
| 68 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
| 69 | |||
| 70 | var messaging = new MockMessaging(); | ||
| 71 | var converter = new WixConverter(messaging, 4, null, null); | ||
| 72 | |||
| 73 | var conversions = converter.FormatDocument(document); | ||
| 74 | |||
| 75 | var actual = UnformattedDocumentString(document); | ||
| 76 | |||
| 77 | Assert.Equal(expected, actual); | ||
| 78 | Assert.Equal(4, conversions); | ||
| 79 | } | ||
| 80 | |||
| 81 | [Fact] | ||
| 82 | public void CanFormatWithNewLineAtEndOfFile() | ||
| 83 | { | ||
| 84 | var parse = String.Join(Environment.NewLine, | ||
| 85 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
| 86 | " <Fragment>", | ||
| 87 | "", | ||
| 88 | " <Property Id='Prop' Value='Val' />", | ||
| 89 | "", | ||
| 90 | " </Fragment>", | ||
| 91 | "</Wix>", | ||
| 92 | ""); | ||
| 93 | |||
| 94 | var expected = String.Join(Environment.NewLine, | ||
| 95 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
| 96 | " <Fragment>", | ||
| 97 | "", | ||
| 98 | " <Property Id=\"Prop\" Value=\"Val\" />", | ||
| 99 | "", | ||
| 100 | " </Fragment>", | ||
| 101 | "</Wix>", | ||
| 102 | ""); | ||
| 103 | |||
| 104 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
| 105 | |||
| 106 | var messaging = new MockMessaging(); | ||
| 107 | var converter = new WixConverter(messaging, 4, null, null); | ||
| 108 | |||
| 109 | var conversions = converter.FormatDocument(document); | ||
| 110 | |||
| 111 | var actual = UnformattedDocumentString(document); | ||
| 112 | |||
| 113 | Assert.Equal(expected, actual); | ||
| 114 | Assert.Equal(3, conversions); | ||
| 115 | } | ||
| 116 | } | ||
| 117 | } | ||
