Esempio n. 1
0
 private void Duplicate()
 {
     if (this.listBoxUnitSystems.SelectedItem != null)
     {
         UnitSystem unitSystem = (UnitSystem)this.listBoxUnitSystems.SelectedItem;
         UnitSystem us         = unitSystem.Clone();
         us.IsReadOnly = false;
         us.Name       = "Copy of " + unitSystem.Name;
         UnitSystemService.GetInstance().GetUnitSystemCatalog().Add(us);
     }
 }
Esempio n. 2
0
        public void Clone_EmptySystem_ReturnsEmptySystem()
        {
            // Arrange
            UnitSystem system = new UnitSystem();

            // Act
            UnitSystem clone = (UnitSystem)system.Clone();

            // Assert
            Assert.NotNull(clone);
            CollectionAssert.IsEmpty(clone.Dimensions);
        }
Esempio n. 3
0
        public void Clone_SingleDimensionSystem_ResultHasSameDimension()
        {
            // Arrange
            var        mockConverter = new Mock <IValueConverter>();
            UnitSystem system        = new UnitSystem();
            IDimension dimension     = CreateStubDimension("M");
            IUnit      baseunit      = CreateStubUnit("base", dimension);
            IUnit      scaledunit    = CreateStubUnit("scaled", dimension);

            system.AddDimension(dimension);
            system.AddBaseUnit(baseunit);
            system.AddScaledUnit(baseunit, scaledunit, mockConverter.Object);

            // Act
            UnitSystem clone = (UnitSystem)system.Clone();

            // Assert
            CollectionAssert.AreEquivalent(system.Dimensions, clone.Dimensions);
        }