示例#1
0
 public static BackupItemType FromDTO(this DTO.BackupItemType source)
 {
     var h = new BackupItemType();
     h.IsEnabled = source.IsEnabled;
     h.ItemGroup = source.ItemGroup;
     h.ItemName = source.ItemName;
     if (source.Task != null)
         h.Task = source.Task.FromDTO();
     if (source.Path != null)
         h.Path = source.Path.Select(wld => wld.FromDTO()).ToList();
     return h;
 }
        public void BackupItemsTest()
        {
            ObservableCollection<BackupItemViewModel> actual;
            actual = target.BackupItems;
            Assert.IsNotNull(actual);
            Assert.IsEmpty(actual);

            BackupItemType bit;
            BackupItemViewModel bivm;
            target.BackupItems.Add(bivm = new BackupItemViewModel(bit = new BackupItemType()));
            actual = target.BackupItems;
            Assert.IsNotEmpty(actual);
            Assert.AreEqual(1, actual.Count);
            Assert.AreSame(bivm, actual[0]);
        }
        public void CloneTest()
        {
            BackupDataViewModel expected = target;
            BackupDataViewModel actual;
            actual = target.Clone();
            Assert.AreNotEqual(expected, actual);
            Assert.AreEqual(expected.DatasetName, actual.DatasetName);
            Assert.AreEqual(0, actual.BackupItems.Count);
            Assert.AreEqual(expected.BackupItems, actual.BackupItems);
            Assert.AreElementsEqual(expected.BackupItems, actual.BackupItems);

            BackupItemType bit;
            BackupItemViewModel bivm;
            target.BackupItems.Add(bivm = new BackupItemViewModel(bit = new BackupItemType()));
            actual = target.Clone();
            Assert.AreNotEqual(expected, actual);
            Assert.AreEqual(expected.DatasetName, actual.DatasetName);
            Assert.AreEqual(1, actual.BackupItems.Count);
            Assert.AreEqual(expected.BackupItems, actual.BackupItems);
            Assert.AreElementsEqual(expected.BackupItems, actual.BackupItems);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="BackupItemViewModel"/> class.
 /// </summary>
 /// <param name="backupItem">The backup item.</param>
 public BackupItemViewModel(BackupItemType backupItem)
 {
     this.data = backupItem;
 }