public void Should_Clone_Logger() { var original = NLog.LogLevel.Trace; var cloned = original.Clone(CloneConfiguration.SkipReadOnlyMembers()); Assert.IsNotNull(cloned); }
internal async Task <string> Clone(SnapSession session) { try { PrimaryBackup b = new PrimaryBackup(); b.BackupName = session.BackupName; CloneBody body = new CloneBody(); CloneConfigurationApplication cloneConfApp = new CloneConfigurationApplication(); cloneConfApp.type = "SMCoreContracts.SmSCCloneConfiguration, SMCoreContracts"; cloneConfApp.MountCmd = new System.Collections.Generic.List <string>(); cloneConfApp.MountCmd.Add($"mount {session.LeafIP}:%mysql_vol_Clone {session.MountPath}"); cloneConfApp.PostCloneCreateCmd = new System.Collections.Generic.List <string>(); cloneConfApp.PostCloneCreateCmd.Add($"{session.MountScript}"); cloneConfApp.Host = session.CloneHostName; CloneConfiguration conf = new CloneConfiguration(); conf.type = "SMCoreContracts.SmCloneConfiguration, SMCoreContracts"; conf.Suffix = string.Empty; // string.Format("_{0}", session.AppName); //set app alias to distiguish clones conf.CloneConfigurationApplication = cloneConfApp; body.CloneConfiguration = conf; body.Backups = new System.Collections.Generic.List <Backups>(); Backups back = new Backups(); back.PrimaryBackup = b; body.Backups.Add(back); var response = await this.SendRequestAsync <dynamic>(Method.POST, $"api/3.0/plugins/{session.Plugin}/resources/{session.DbKey}/clone", body, false); return(response.Response.StatusCode.ToString()); } catch (Exception ex) { this.log.Error($"Error while cloning {session.DbKey}: {ex}"); throw; } }
public void Should_Ignore_ByAttribute_ViaConfigurationAttributesNamesIgnore() { var test = new BasicObjectWithIgnore { BoolValue = true, ByteValue = 1, IntValue = 100, LongValue = 1000, StringValue = "A test string" }; var clonedObject = test.Clone(CloneConfiguration.UsingAttributeNamesToIgnore("IgnoreDataMemberAttribute")); Assert.AreEqual(test, clonedObject); Assert.IsNull(clonedObject.StringValue); }