diff options
Diffstat (limited to 'src/test/WixToolsetTest.Data/SerializeFixture.cs')
| -rw-r--r-- | src/test/WixToolsetTest.Data/SerializeFixture.cs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.Data/SerializeFixture.cs b/src/test/WixToolsetTest.Data/SerializeFixture.cs new file mode 100644 index 00000000..9883053f --- /dev/null +++ b/src/test/WixToolsetTest.Data/SerializeFixture.cs | |||
| @@ -0,0 +1,43 @@ | |||
| 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.Data | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.IO; | ||
| 7 | using System.Linq; | ||
| 8 | using WixToolset.Data; | ||
| 9 | using WixToolset.Data.Tuples; | ||
| 10 | using Xunit; | ||
| 11 | |||
| 12 | public class SerializeFixture | ||
| 13 | { | ||
| 14 | [Fact] | ||
| 15 | public void CanSaveAndLoadIntermediate() | ||
| 16 | { | ||
| 17 | var sln = new SourceLineNumber("test.wxs", 1); | ||
| 18 | |||
| 19 | var section = new IntermediateSection("test", SectionType.Product, 65001); | ||
| 20 | |||
| 21 | section.Tuples.Add(new ComponentTuple(sln, new Identifier("TestComponent", AccessModifier.Public)) | ||
| 22 | { | ||
| 23 | ComponentId = new Guid(1, 0, 0, new byte[8]).ToString("B"), | ||
| 24 | Directory_ = "TestFolder", | ||
| 25 | Attributes = 2, | ||
| 26 | }); | ||
| 27 | |||
| 28 | var intermediate = new Intermediate("TestIntermediate", new[] { section }, null, null); | ||
| 29 | |||
| 30 | var path = Path.GetTempFileName(); | ||
| 31 | intermediate.Save(path); | ||
| 32 | |||
| 33 | var loaded = Intermediate.Load(path); | ||
| 34 | |||
| 35 | var tuple = (ComponentTuple)loaded.Sections.Single().Tuples.Single(); | ||
| 36 | |||
| 37 | Assert.Equal("TestComponent", tuple.Id.Id); | ||
| 38 | Assert.Equal(AccessModifier.Public, tuple.Id.Access); | ||
| 39 | Assert.Equal("TestFolder", tuple.Directory_); | ||
| 40 | Assert.Equal(2, tuple.Attributes); | ||
| 41 | } | ||
| 42 | } | ||
| 43 | } | ||
