NMaier.SimpleDlna.GUI.ServerDescription.AdoptInfo C# (CSharp) Méthode

AdoptInfo() public méthode

public AdoptInfo ( ServerDescription other ) : void
other ServerDescription
Résultat void
        public void AdoptInfo(ServerDescription other)
        {
            if (other == null) {
            throw new ArgumentNullException(nameof(other));
              }
              Directories = other.Directories;
              Name = other.Name;
              Order = other.Order;
              OrderDescending = other.OrderDescending;
              Types = other.Types;
              Views = other.Views;
              Macs = other.Macs;
              Ips = other.Ips;
              UserAgents = other.UserAgents;
        }

Usage Example

 public void ServerDescription_AdoptInfo_Test()
 {
     var data = new ServerDescription {
     Directories = new [] { "dir1", "dir2" },
     Name = "data",
     Order = "Order",
     FileStore = "FileStore",
     OrderDescending = false,
     Types = DlnaMediaTypes.All,
     Views = new [] { "Views1", "Views2" },
     Macs = new [] { "Mac1", "Mac2" },
     Ips = new [] { "IP1", "IP2" },
     UserAgents = new [] { "UserAgent1", "UserAgent2" }
       };
       var data2 = new ServerDescription();
       data2.AdoptInfo(data);
       Assert.AreEqual(data.Directories, data2.Directories);
       Assert.AreEqual(data.Name, data2.Name);
       Assert.AreEqual(data.Order, data2.Order);
       Assert.AreEqual(data.FileStore, data2.FileStore);
       Assert.AreEqual(data.OrderDescending, data2.OrderDescending);
       Assert.AreEqual(data.Types, data2.Types);
       Assert.AreEqual(data.Views, data2.Views);
       Assert.AreEqual(data.Macs, data2.Macs);
       Assert.AreEqual(data.Ips, data2.Ips);
       Assert.AreEqual(data.UserAgents, data2.UserAgents);
       var filenames = new[] { "ServerDescription.tmp1", "ServerDescription.tmp2" };
       try {
     XmlHelper.ToFile(data, filenames[0]);
     XmlHelper.ToFile(data2, filenames[1]);
     Assert.AreEqual(File.ReadAllText(filenames[0]), File.ReadAllText(filenames[1]));
       }
       finally {
     if (File.Exists(filenames[0])) File.Delete(filenames[0]);
     if (File.Exists(filenames[1])) File.Delete(filenames[1]);
       }
 }
All Usage Examples Of NMaier.SimpleDlna.GUI.ServerDescription::AdoptInfo