public void OuterServicesRedirected() { var dummyMessagingImplementation = new DummyMessaging(); DummyMessagingHashCode = dummyMessagingImplementation.GetHashCode(); var dummyStorageImplementation = new DummyStorage(); DummyStorageHashCode = dummyStorageImplementation.GetHashCode(); var serviceProvider = new ServiceCollection() .AddSingleton <IMessagingInfrastructure>(r => dummyMessagingImplementation) .AddSingleton <IStorageInfrastructure>(r => dummyStorageImplementation) .BuildServiceProvider(); var messageDispatcherMock = Substitute.For <IServiceMessageDispatcher>(); var manifests = new List <IServiceAssemblyManifest> { new DummyServiceManifest() }; var sut = new ServiceHost(serviceProvider, NullLogger <ServiceHost> .Instance, messageDispatcherMock, manifests); sut.StartServices(); // Assertions are in DummyService.Start... i know, this doesn't win a design price but i have no better idea at the moment. }
public void CanConvertSuppressSignatureValidationYes() { var parse = String.Join(Environment.NewLine, "<?xml version='1.0' encoding='utf-8'?>", "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", " <Payload SuppressSignatureValidation='yes' />", "</Wix>"); var expected = String.Join(Environment.NewLine, "<?xml version=\"1.0\" encoding=\"utf-16\"?>", "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Payload />", "</Wix>"); var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new DummyMessaging(); var converter = new Converter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); var actual = UnformattedDocumentString(document); Assert.Equal(1, errors); Assert.Equal(expected, actual); }
public void CanFixWhitespace() { var parse = String.Join(Environment.NewLine, "<?xml version='1.0' encoding='utf-8'?>", "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", " <Fragment>", " <Property Id='Prop'", " Value='Val'>", " </Property>", " </Fragment>", "</Wix>"); var expected = String.Join(Environment.NewLine, "<?xml version=\"1.0\" encoding=\"utf-16\"?>", "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Fragment>", " <Property Id=\"Prop\" Value=\"Val\" />", " </Fragment>", "</Wix>"); var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new DummyMessaging(); var converter = new Converter(messaging, 4, null, null); var errors = converter.ConvertDocument(document); var actual = UnformattedDocumentString(document); Assert.Equal(expected, actual); Assert.Equal(4, errors); }
public void CanConvertShortNameDirectoryWithoutName() { var parse = String.Join(Environment.NewLine, "<?xml version='1.0' encoding='utf-8'?>", "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", " <Directory ShortName='iamshort' />", "</Wix>"); var expected = String.Join(Environment.NewLine, "<?xml version=\"1.0\" encoding=\"utf-16\"?>", "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Directory Name=\"iamshort\" />", "</Wix>"); var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new DummyMessaging(); var converter = new Converter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); var actual = UnformattedDocumentString(document); Assert.Equal(1, errors); Assert.Equal(expected, actual); }
public void CanConvertAnonymousFile() { var parse = String.Join(Environment.NewLine, "<?xml version='1.0' encoding='utf-8'?>", "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", " <File Source='path\\to\\foo.txt' />", "</Wix>"); var expected = String.Join(Environment.NewLine, "<?xml version=\"1.0\" encoding=\"utf-16\"?>", "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <File Id=\"foo.txt\" Source=\"path\\to\\foo.txt\" />", "</Wix>"); var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new DummyMessaging(); var converter = new Converter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); var actual = UnformattedDocumentString(document); Assert.Equal(1, errors); Assert.Equal(expected, actual); }
public void CanConvertMissingNamespace() { var parse = String.Join(Environment.NewLine, "<?xml version='1.0' encoding='utf-8'?>", "<Wix>", " <Fragment />", "</Wix>"); var expected = String.Join(Environment.NewLine, "<?xml version=\"1.0\" encoding=\"utf-16\"?>", "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Fragment />", "</Wix>"); var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new DummyMessaging(); var converter = new Converter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); var actual = UnformattedDocumentString(document); Assert.Equal(1, errors); Assert.Equal(expected, actual); Assert.Equal(Wix4Namespace, document.Root.GetDefaultNamespace()); }
public void CanConvertNonWixDefaultNamespace() { var parse = String.Join(Environment.NewLine, "<?xml version='1.0' encoding='utf-8'?>", "<w:Wix xmlns:w='http://schemas.microsoft.com/wix/2006/wi' xmlns='http://schemas.microsoft.com/wix/UtilExtension'>", " <w:Fragment>", " <Test />", " </w:Fragment>", "</w:Wix>"); var expected = String.Join(Environment.NewLine, "<?xml version=\"1.0\" encoding=\"utf-16\"?>", "<w:Wix xmlns:w=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns=\"http://wixtoolset.org/schemas/v4/wxs/util\">", " <w:Fragment>", " <Test />", " </w:Fragment>", "</w:Wix>"); var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new DummyMessaging(); var converter = new Converter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); var actual = UnformattedDocumentString(document); Assert.Equal(expected, actual); Assert.Equal(2, errors); Assert.Equal(Wix4Namespace, document.Root.GetNamespaceOfPrefix("w")); Assert.Equal("http://wixtoolset.org/schemas/v4/wxs/util", document.Root.GetDefaultNamespace()); }
public void EnsuresUtf8Declaration() { var parse = String.Join(Environment.NewLine, "<?xml version='1.0'?>", "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", " <Fragment />", "</Wix>"); var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new DummyMessaging(); var converter = new Converter(messaging, 4, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(1, errors); Assert.Equal("1.0", document.Declaration.Version); Assert.Equal("utf-8", document.Declaration.Encoding); }