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

            // When
            TestDelegate buildMsi = () =>
                                    Compiler.BuildMsi(project, installerPath);

            // Then
            Assert.DoesNotThrow(buildMsi);
            Assert.True(System.IO.File.Exists(installerPath));
        }
예제 #2
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));
        }
예제 #3
0
        public void BuildSync_When_Dirty_Context()
        {
            // Given
            var installerPath = Path.Combine(_outputPath, $"{nameof(BuildSync_When_Dirty_Context)}.msi");
            var project       = TestProjectBuilder.CreateProject(_outputPath);

            // When

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

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

            // Then
            Assert.Throws <SerializationException>(buildMsi);
            Assert.False(System.IO.File.Exists(installerPath));
        }
예제 #4
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));
        }