Example #1
0
        public void BuildAsync_In_New_Context_When_Clean_Context()
        {
            // Given
            var installerPath = Path.Combine(_outputPath, $"{nameof(BuildAsync_In_New_Context_When_Clean_Context)}.msi");
            var project       = TestProjectBuilder.CreateProject(_outputPath);

            // When

            AsyncTestDelegate buildMsi = async() =>
                                         await WixSharpAsyncHelper.ExecuteInNewContext(() =>
                                                                                       Compiler.BuildMsi(project, installerPath));

            // Then
            Assert.DoesNotThrowAsync(buildMsi);
            Assert.True(System.IO.File.Exists(installerPath));
        }
Example #2
0
        public void BuildSync_In_New_Context_When_Dirty_Context()
        {
            // Given
            var installerPath = Path.Combine(_outputPath, $"{nameof(BuildSync_In_New_Context_When_Dirty_Context)}.msi");
            var project       = TestProjectBuilder.CreateProject(_outputPath);

            // When

            CallContext.LogicalSetData("key1", new SomeContextClass());

            TestDelegate buildMsi = () =>
                                    WixSharpAsyncHelper.ExecuteInNewContext(() =>
                                                                            Compiler.BuildMsi(project, installerPath)).Wait();

            // Then
            Assert.DoesNotThrow(buildMsi);
            Assert.True(System.IO.File.Exists(installerPath));
        }