コード例 #1
0
        public void Initialize_Sets_Default_Type_And_Empty_List()
        {
            cUnitMass unitMass = new cUnitMass();

            Assert.That(cUnitMass.UnitDefault, Is.EqualTo(cUnitMass.eUnit.PoundMass));
            Assert.IsTrue(cUnitMass.UnitsList.Contains(""));
            Assert.IsTrue(cUnitMass.UnitsList.Contains("kg"));
            Assert.IsTrue(cUnitMass.UnitsList.Contains("lbm"));
            Assert.That(unitMass.Unit, Is.EqualTo(cUnitMass.UnitDefault));
        }
コード例 #2
0
        public void SetToDefault_Resets_Unit_To_Default()
        {
            cUnitMass unitMass = new cUnitMass();

            cUnitMass.eUnit defaultUnit = cUnitMass.UnitDefault;

            Assert.That(defaultUnit, Is.EqualTo(cUnitMass.eUnit.PoundMass));
            unitMass.Unit = cUnitMass.eUnit.Kilogram;
            Assert.That(unitMass.Unit, Is.EqualTo(cUnitMass.eUnit.Kilogram));

            unitMass.SetToDefault();
            Assert.That(unitMass.Unit, Is.EqualTo(cUnitMass.eUnit.PoundMass));
        }