Exemplo n.º 1
0
 public virtual void Format()
 {
     if(Long_Name == null){
         Long_Name = string.Empty;
     }
     if(Short_Name == null){
         Short_Name = string.Empty;
     }
     if (unit == null) {
         unit = new PUnit();
     }
 }
Exemplo n.º 2
0
        public void PUnit_WithNullMembers_WhenFormatted_HasEmptyMembers()
        {
            //Arrange: a unit with null members is constructed.
            PUnit unit = new PUnit {
                Long_Name = null,
                Short_Name = null
            };

            //Act: The unit is formatted.
            unit.Format();

            //Assert: The unit's null members are replaced with empty members.
            Assert.AreEqual(string.Empty, unit.Long_Name);
            Assert.AreEqual(string.Empty, unit.Short_Name);
        }