public void ForgeQuantityEquality() { var quantityType = Quantity.ByTypeID("autodesk.unit.quantity:length-1.0.4"); var quantityType2 = Quantity.ByTypeID("autodesk.unit.quantity:length-1.0.4"); var quantityType3 = Quantity.ByTypeID("autodesk.unit.quantity:volume-1.0.1"); Assert.NotNull(quantityType); Assert.NotNull(quantityType2); Assert.NotNull(quantityType3); Assert.True(quantityType.Equals(quantityType2)); Assert.True(quantityType2.Equals(quantityType)); Assert.False(quantityType.Equals(quantityType3)); Assert.False(quantityType3.Equals(quantityType)); Assert.True(quantityType == quantityType2); Assert.True(quantityType2 == quantityType); Assert.False(quantityType == quantityType3); Assert.False(quantityType3 == quantityType); Assert.False(quantityType != quantityType2); Assert.False(quantityType2 != quantityType); Assert.True(quantityType != quantityType3); Assert.True(quantityType3 != quantityType); var dictionary = new Dictionary <Quantity, string>(); dictionary.Add(quantityType, "0"); dictionary[quantityType2] = "1"; dictionary.Add(quantityType3, "2"); Assert.AreEqual(2, dictionary.Count); Assert.AreEqual(dictionary[quantityType], "1"); Assert.AreEqual(dictionary[quantityType2], "1"); Assert.AreEqual(dictionary[quantityType3], "2"); }
public void CanCreateForgeQuantity_FromLoadedTypeId() { var unitType = Unit.ByTypeID($"{milimeters}-1.0.1"); var quantityType = Quantity.ByTypeID("autodesk.unit.quantity:length-1.0.4"); Assert.IsTrue(quantityType.Units.Contains(unitType)); }
public void ForgeQuantityContainsMultipleUnits() { var quantityType = Quantity.ByTypeID("autodesk.unit.quantity:length-1.0.5"); Assert.GreaterOrEqual(16, quantityType.Units.Count()); }