public void Should_Not_Throw_If_Log_Is_Null_When_Logging_With_Custom_Verbosity() { // Given, When var result = Record.Exception(() => LogExtensions.Debug(null, Verbosity.Normal, "Hello World")); // Then Assert.Null(result); }
public DeploymentChangeSummary Deploy(DeploySettings settings) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } DeploymentBaseOptions baseOptions1 = new DeploymentBaseOptions(); DeploymentBaseOptions baseOptions2 = this.GetBaseOptions(settings); FilePath sourcePath = settings.SourcePath; string str1; if (sourcePath == null) { str1 = (string)null; } else { ICakeEnvironment environment = this.environment; FilePath filePath = sourcePath.MakeAbsolute(environment); str1 = filePath != null ? ((Path)filePath).FullPath : (string)null; } string path1 = str1; FilePath destinationPath = settings.DestinationPath; string str2; if (destinationPath == null) { str2 = (string)null; } else { ICakeEnvironment environment = this.environment; FilePath filePath = destinationPath.MakeAbsolute(environment); str2 = filePath != null ? ((Path)filePath).FullPath : (string)null; } string path2 = str2; LogExtensions.Information(this.log, (Verbosity)2, "CCC", new object[0]); baseOptions2.TraceLevel = settings.TraceLevel; baseOptions2.Trace += new EventHandler <DeploymentTraceEventArgs>(this.OnTraceEvent); if (settings.DestProvider == DeploymentWellKnownProvider.Auto) { path2 = settings.SiteName; } DeploymentSyncOptions deploymentSyncOptions = new DeploymentSyncOptions(); int num1 = !settings.Delete ? 1 : 0; deploymentSyncOptions.DoNotDelete = num1 != 0; int num2 = settings.WhatIf ? 1 : 0; deploymentSyncOptions.WhatIf = num2 != 0; DeploymentSyncOptions syncOptions = deploymentSyncOptions; if (settings.DeclareParamFile != null) { syncOptions.DeclaredParameters.Load(((Path)settings.DeclareParamFile.MakeAbsolute(this.environment)).FullPath); } foreach (SkipRule skipRule in settings.SkipRules) { syncOptions.Rules.Add((DeploymentRule) new DeploymentSkipRule(skipRule.Name, skipRule.SkipAction, skipRule.ObjectName, skipRule.AbsolutePath, skipRule.XPath)); } LogExtensions.Information(this.log, (Verbosity)2, "Deploying Website...", new object[0]); LogExtensions.Debug(this.log, (Verbosity)2, string.Format("-siteName '{0}'", (object)settings.SiteName), new object[0]); LogExtensions.Debug(this.log, (Verbosity)2, string.Format("-destination '{0}'", (object)settings.PublishUrl), new object[0]); LogExtensions.Debug(this.log, (Verbosity)2, string.Format("-source '{0}'", (object)path1), new object[0]); LogExtensions.Debug(this.log, string.Empty, new object[0]); using (DeploymentObject deploymentObject = DeploymentManager.CreateObject(settings.SourceProvider, path1, baseOptions1)) { foreach (KeyValuePair <string, string> parameter in settings.Parameters) { deploymentObject.SyncParameters[parameter.Key].Value = parameter.Value; } return(deploymentObject.SyncTo(settings.DestProvider, path2, baseOptions2, syncOptions)); } }