public void Success_Begin() { List <ServiceItem> services = new List <ServiceItem> { new ServiceItem { ServiceName = "Test", DisplayName = "Test Service", BinaryPathName = @"G:\test.exe", TargetFramework = TargetFramework.Net35 } }; ServiceTransaction.Begin(services); var serviceTransactionFileName = ServiceTransaction.FilePathName; string actual = File.ReadAllText(serviceTransactionFileName); File.Delete(serviceTransactionFileName); string expected = Resources.BeginInstalledServicesXmlFile; Assert.AreEqual( expected, actual); }
public void Failed_Begin() { File.WriteAllText( ServiceTransaction.FilePathName, Resources.BeginInstalledServicesXmlFile); List <ServiceItem> services = new List <ServiceItem> { new ServiceItem { ServiceName = "Test", DisplayName = "Test Service", BinaryPathName = @"G:\test.exe", TargetFramework = TargetFramework.Net35 } }; TestHelper.Throws( () => ServiceTransaction.Begin(services), typeof(InvalidOperationException)); File.Delete(ServiceTransaction.FilePathName); }