public string ParseStringToShorthandUnits(string unitsToParse) { cUnitsController unitsController = new cUnitsController(); unitsController.ParseStringToShorthandUnits(unitsToParse); return(unitsController.Units.GetUnitsLabel()); }
public void Equals_Compares_Objects_By_Properties_That_Are_Not_Equal_Returns_False() { cUnitsController unitsController1 = new cUnitsController(); unitsController1.SetTypeByShorthand(cUnitsController.eUnitTypeShorthand.Power); Assert.That(unitsController1.QuickUnitTypes.Count, Is.EqualTo(11)); Assert.That(unitsController1.AllUnitTypes.Count, Is.EqualTo(31)); Assert.That(unitsController1.ShorthandUnitsAvailable.Count, Is.EqualTo(5)); Assert.That(unitsController1.Type, Is.EqualTo(cUnitsController.eUnitTypeStandard.Power)); Assert.That(unitsController1.TypeShorthand, Is.EqualTo(cUnitsController.eUnitTypeShorthand.None)); Assert.That(unitsController1.Units, Is.EqualTo(new cUnits())); cUnitsController unitsController2 = new cUnitsController(); unitsController2.SetTypeByShorthand(cUnitsController.eUnitTypeShorthand.Work); Assert.That(unitsController2.QuickUnitTypes.Count, Is.EqualTo(11)); Assert.That(unitsController2.AllUnitTypes.Count, Is.EqualTo(31)); Assert.That(unitsController2.ShorthandUnitsAvailable.Count, Is.EqualTo(5)); Assert.That(unitsController2.Type, Is.EqualTo(cUnitsController.eUnitTypeStandard.Work)); Assert.That(unitsController2.TypeShorthand, Is.EqualTo(cUnitsController.eUnitTypeShorthand.None)); Assert.That(unitsController2.Units, Is.EqualTo(new cUnits())); // Method Under Test Assert.That(!unitsController1.Equals(unitsController2)); }
public void Clone_Clones_Object() { cUnitsController unitsController = new cUnitsController(); Assert.That(unitsController.QuickUnitTypes.Count, Is.EqualTo(11)); Assert.That(unitsController.AllUnitTypes.Count, Is.EqualTo(31)); Assert.That(unitsController.ShorthandUnitsAvailable.Count, Is.EqualTo(0)); Assert.That(unitsController.Type, Is.EqualTo(cUnitsController.eUnitTypeStandard.None)); Assert.That(unitsController.TypeShorthand, Is.EqualTo(cUnitsController.eUnitTypeShorthand.None)); Assert.That(unitsController.Units, Is.EqualTo(new cUnits())); unitsController.SetTypeByShorthand(cUnitsController.eUnitTypeShorthand.Power); Assert.That(unitsController.QuickUnitTypes.Count, Is.EqualTo(11)); Assert.That(unitsController.AllUnitTypes.Count, Is.EqualTo(31)); Assert.That(unitsController.ShorthandUnitsAvailable.Count, Is.EqualTo(5)); Assert.That(unitsController.Type, Is.EqualTo(cUnitsController.eUnitTypeStandard.Power)); Assert.That(unitsController.TypeShorthand, Is.EqualTo(cUnitsController.eUnitTypeShorthand.None)); Assert.That(unitsController.Units, Is.EqualTo(new cUnits())); object unitsControllerClone = unitsController.Clone(); Assert.That(unitsControllerClone is cUnitsController); cUnitsController unitsControllerCloneCast = (cUnitsController)unitsControllerClone; Assert.That(unitsControllerCloneCast.QuickUnitTypes.Count, Is.EqualTo(11)); Assert.That(unitsControllerCloneCast.AllUnitTypes.Count, Is.EqualTo(31)); Assert.That(unitsControllerCloneCast.ShorthandUnitsAvailable.Count, Is.EqualTo(5)); Assert.That(unitsControllerCloneCast.Type, Is.EqualTo(cUnitsController.eUnitTypeStandard.Power)); Assert.That(unitsControllerCloneCast.TypeShorthand, Is.EqualTo(cUnitsController.eUnitTypeShorthand.None)); Assert.That(unitsControllerCloneCast.Units, Is.EqualTo(new cUnits())); }
public string AssignShorthandUnits_With_Schema_Type(string shorthandName, string schemaType) { cUnitsController unitsController = new cUnitsController(); unitsController.AssignShorthandUnits(shorthandName, schemaType); return(unitsController.Units.GetUnitsLabel()); }
public string AssignShorthandUnits(string shorthandName) { cUnitsController unitsController = new cUnitsController(); unitsController.AssignShorthandUnits(shorthandName); return(unitsController.Units.GetUnitsLabel()); }
public void IsShorthandTypesAvailable(string value, bool isShorthandTypesAvailable) { cUnitsController unitsController = new cUnitsController(); unitsController.SetTypeByDescription(value); Assert.That(unitsController.IsShorthandTypesAvailable(), Is.EqualTo(isShorthandTypesAvailable)); }
public void SetTypeByShorthand_Without_Schema_Types_Defined( cUnitsController.eUnitTypeShorthand value, cUnitsController.eUnitTypeStandard result) { cUnitsController unitsController = new cUnitsController(); unitsController.SetTypeByShorthand(value); Assert.That(unitsController.Type, Is.EqualTo(result)); }
public void AssignShorthandUnits_With_Empty_Shorthand_Name_Removes_Shorthand_Units(string shorthandName) { cUnitsController unitsController = new cUnitsController(); unitsController.AssignShorthandUnits("lb*ft"); //Assert.That(unitsController.Units.GetUnitsLabel(), Is.EqualTo("lb*ft")); unitsController.AssignShorthandUnits(shorthandName); Assert.That(unitsController.Units.GetUnitsLabel(), Is.EqualTo("")); }
public void AllUnitTypes_Is_Immutable() { cUnitsController unitsController = new cUnitsController(); Assert.That(unitsController.AllUnitTypes.Count, Is.EqualTo(31)); unitsController.AllUnitTypes.Add("FooBar"); Assert.That(unitsController.AllUnitTypes.Count, Is.EqualTo(31)); Assert.IsFalse(unitsController.AllUnitTypes.Contains("FooBar")); }
[TestCase(cUnitsController.eUnitTypeShorthand.SpeedAngular, "Displacement (Rotation)", cUnitsController.eUnitTypeStandard.DisplacementRotational)] // TODO: This should not be allowed public void SetTypeByShorthand_With_Schema_Types_Defined( cUnitsController.eUnitTypeShorthand value, string schema, cUnitsController.eUnitTypeStandard result) { // TODO: Limit schema types to appropriate sub-categories. cUnitsController unitsController = new cUnitsController(); unitsController.SetTypeByShorthand(value, schema); Assert.That(unitsController.Type, Is.EqualTo(result)); }
public void SetTypeByDescription_Of_Existing_Description_Changes_Type( string value, cUnitsController.eUnitTypeStandard result) { cUnitsController unitsController = new cUnitsController(); Assert.That(unitsController.Type, Is.EqualTo(cUnitsController.eUnitTypeStandard.None)); unitsController.SetTypeByDescription(value); Assert.That(unitsController.Type, Is.EqualTo(result)); }
public void Initialization_Basic_Sets_Defaults() { cUnitsController unitsController = new cUnitsController(); Assert.That(unitsController.QuickUnitTypes.Count, Is.EqualTo(11)); Assert.That(unitsController.AllUnitTypes.Count, Is.EqualTo(31)); Assert.That(unitsController.ShorthandUnitsAvailable.Count, Is.EqualTo(0)); Assert.That(unitsController.Type, Is.EqualTo(cUnitsController.eUnitTypeStandard.None)); Assert.That(unitsController.TypeShorthand, Is.EqualTo(cUnitsController.eUnitTypeShorthand.None)); Assert.That(unitsController.Units, Is.EqualTo(new cUnits())); }
public void ShorthandUnitsAvailable_Is_Immutable() { cUnitsController unitsController = new cUnitsController(); Assert.That(unitsController.ShorthandUnitsAvailable.Count, Is.EqualTo(0)); unitsController.ShorthandUnitsAvailable.Add("FooBar"); Assert.That(unitsController.ShorthandUnitsAvailable.Count, Is.EqualTo(0)); Assert.IsFalse(unitsController.ShorthandUnitsAvailable.Contains("FooBar")); }
public void MakeUnitsConsistent() { cUnitsController unitsController = new cUnitsController(); unitsController.ParseStringToUnits("lb*kN/in"); Assert.That(unitsController.Units.GetUnitsLabel(), Is.EqualTo("(lb*kN)/in")); string unitsToApply = "lb, ft"; unitsController.MakeUnitsConsistent(unitsToApply); Assert.That(unitsController.Units.GetUnitsLabel(), Is.EqualTo("lb/ft")); }
public void MakeUnitsConsistent_From_List() { cUnitsController unitsController = new cUnitsController(); unitsController.ParseStringToUnits("lb*kN/in"); Assert.That(unitsController.Units.GetUnitsLabel(), Is.EqualTo("(lb*kN)/in")); List <string> unitsToApply = new List <string> { "lb", "ft" }; unitsController.MakeUnitsConsistent(unitsToApply); Assert.That(unitsController.Units.GetUnitsLabel(), Is.EqualTo("lb/ft")); }
public void Units_Is_Immutable() { cUnitsController unitsController = new cUnitsController(); Assert.That(unitsController.Units, Is.EqualTo(new cUnits())); cUnit illegalUnit = new cUnit(eUnitType.Force); illegalUnit.SetUnitName("lb"); cUnits immutableUnits = unitsController.Units; immutableUnits.AddUnit(illegalUnit); Assert.IsTrue(unitsController.Units.Equals(new cUnits())); }
public void SetTypeByDescription_Of_NonExisting_Description_Changes_Type_To_None() { cUnitsController unitsController = new cUnitsController(); Assert.That(unitsController.Type, Is.EqualTo(cUnitsController.eUnitTypeStandard.None)); unitsController.SetTypeByDescription("FooBar"); Assert.That(unitsController.Type, Is.EqualTo(cUnitsController.eUnitTypeStandard.None)); unitsController.SetTypeByDescription("Displacement (Rotation)"); Assert.That(unitsController.Type, Is.EqualTo(cUnitsController.eUnitTypeStandard.DisplacementRotational)); unitsController.SetTypeByDescription("FooBar"); Assert.That(unitsController.Type, Is.EqualTo(cUnitsController.eUnitTypeStandard.None)); }
public void ConvertTo() { cUnitsController unitsController = new cUnitsController(); Assert.IsTrue(false); }
public void GetShorthandTypeByUnits() { cUnitsController unitsController = new cUnitsController(); Assert.IsTrue(false); }
public void GetShorthandNamesList() { cUnitsController unitsController = new cUnitsController(); Assert.IsTrue(false); }
public void RemoveShorthandUnits() { cUnitsController unitsController = new cUnitsController(); Assert.IsTrue(false); }