本文整理汇总了C#中Mass类的典型用法代码示例。如果您正苦于以下问题:C# Mass类的具体用法?C# Mass怎么用?C# Mass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Mass类属于命名空间,在下文中一共展示了Mass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MassBothInequality
public void MassBothInequality()
{
Mass m1 = new Mass(524.342);
Mass m2 = new Mass(524.343);
Assert.AreNotEqual(m1, m2);
}
示例2: VerifyAllEnums
public void VerifyAllEnums()
{
var acceleration = new Acceleration(1, AccelerationUnit.BaseUnit);
var angle = new Angle(1, AngleUnit.BaseUnit);
var angularAcceleration = new AngularAcceleration(1, AngularAccelerationUnit.BaseUnit);
var area = new Area(1, AreaUnit.BaseUnit);
var density = new MassDensity(1, MassDensityUnit.BaseUnit);
var electricCurrent = new ElectricCurrent(1, ElectricCurrentUnit.BaseUnit);
var electricResistance = new ElectricResistance(1, ElectricResistanceUnit.BaseUnit);
var electricVoltage = new ElectricPotential(1, ElectricPotentialUnit.BaseUnit);
var energy = new Energy(1, EnergyUnit.BaseUnit);
var force = new Force(1, ForceUnit.BaseUnit);
var frequency = new Frequency(1, FrequencyUnit.BaseUnit);
var jerk = new Jerk(1, JerkUnit.BaseUnit);
var length = new Length(1, LengthUnit.BaseUnit);
var mass = new Mass(1, MassUnit.BaseUnit);
var massFlowRate = new MassFlowRate(1, MassFlowRateUnit.BaseUnit);
var momentum = new Momentum(1, MomentumUnit.BaseUnit);
var numeric = new Numeric(1, NumericUnit.BaseUnit);
var power = new Power(1, PowerUnit.BaseUnit);
var pressure = new Pressure(1, PressureUnit.BaseUnit);
var speed = new Speed(1, SpeedUnit.BaseUnit);
var temperature = new Temperature(1, TemperatureUnit.BaseUnit);
var time = new Time(1, TimeUnit.BaseUnit);
var torque = new Torque(1, TorqueUnit.BaseUnit);
var volume = new Volume(1, VolumeUnit.BaseUnit);
var volumetricFlowRate = new VolumetricFlowRate(1, VolumetricFlowRateUnit.BaseUnit);
}
示例3: Test_this
public void Test_this (double massValue, double secondValue, double expectedValue)
{
var _mass = new Mass (MeasurementSystem.InternationalSystemOfUnits, massValue);
var _second = new Mass (MeasurementSystem.InternationalSystemOfUnits, secondValue);
var _sum = _mass + _second;
Assert.AreEqual (expectedValue, _sum [MeasurementSystem.InternationalSystemOfUnits]);
}
示例4: ConvertToSi
public void ConvertToSi(Mass m, string dimension)
{
if (dimension != "kg")
{
if (dimension == "t")
{
m.Value *= 1000;
}
else if (dimension == "sl")
{
m.Value *= 14.6;
}
else if (dimension == "Ib")
{
m.Value *= 0.45;
}
else if (dimension == "g")
{
m.Value /= 1000;
}
else if (dimension == "mg")
{
m.Value /= 1000000000;
}
else
{
throw new IncorrectDimensionOfMassException();
}
}
}
示例5: MassEquality
public void MassEquality()
{
Mass m1 = new Mass(524.342);
Mass m2 = new Mass(524.342);
Assert.AreEqual(m1, m2);
}
示例6: can_use_mass_volume_constructor
[Test] public void can_use_mass_volume_constructor() {
Mass m = new Mass(10, MassUnit.Pounds);
Volume v = new Volume(2, VolumeUnit.Gallons);
var d = new Density(m, v);
d.Mass.ShouldEqual(m);
d.Volume.ShouldEqual(v);
}
示例7: MassObjectToMzNegativeCharge
public void MassObjectToMzNegativeCharge()
{
Mass m1 = new Mass(1000);
double mz = m1.ToMz(-2);
Assert.AreEqual(498.99272353318798, mz);
}
示例8: MassMonoisotopicInequality
public void MassMonoisotopicInequality()
{
Mass m1 = new Mass(524.342);
Mass m2 = new Mass(524.343);
Assert.AreNotEqual(m1, m2);
}
示例9: ConstructorIMassRefInequality
public void ConstructorIMassRefInequality()
{
IMass m = new Mass(524.342);
Mass m2 = new Mass(m);
Assert.AreNotSame(m, m2);
}
示例10: ConstructorIMass
public void ConstructorIMass()
{
IMass m = new Mass(524.342);
Mass m2 = new Mass(m);
Assert.AreEqual(m, m2);
}
示例11: OpAddition
public void OpAddition()
{
var mass1 = new Mass(2000, MassUnit.Gram);
var mass2 = new Mass(1, MassUnit.Kilogram);
var expected = new Mass(3000, MassUnit.Gram);
(mass1 + mass2).ShouldEqual(expected);
(mass2 + mass1).ShouldEqual(expected);
}
示例12: Convert
public Mass Convert(Mass from, MassUnit to) {
if (from.Unit.Equals(to))
return new Mass(from.Amount, to);
var tfs = new FromToConversion(from.Unit, to);
if(!_knownConversions.ContainsKey(tfs))
throw new NotImplementedException("This conversion has not yet been implemented");
return new Mass(from.Amount * _knownConversions[tfs], to);
}
示例13: pictureBox1_MouseClick
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
{
Mass m = new Mass(e.Location.X, e.Location.Y, Int32.Parse(textBox1.Text));
lista.Add(m);
reloadPicture();
//tu bedzie reloadPicture() z wyliczeniem kropek i potem linii
reloadPotencjal();
pictureBox1.Refresh();
reloadBox();
}
示例14: OpInverseEquals
public void OpInverseEquals()
{
var mass1 = new Mass(3000, MassUnit.Gram);
var mass2 = new Mass(3, MassUnit.Kilogram);
var mass3 = new Mass(4, MassUnit.Kilogram);
(mass1 != mass2).ShouldBeFalse();
(mass2 != mass1).ShouldBeFalse();
(mass1 != mass3).ShouldBeTrue();
(mass3 != mass1).ShouldBeTrue();
}
示例15: OpGreaterThanOrEqual
public void OpGreaterThanOrEqual()
{
var mass1 = new Mass(3000, MassUnit.Gram);
var mass2 = new Mass(3, MassUnit.Kilogram);
var mass3 = new Mass(4, MassUnit.Kilogram);
(mass1 >= mass3).ShouldBeFalse();
(mass3 >= mass1).ShouldBeTrue();
(mass1 >= mass2).ShouldBeTrue();
(mass2 >= mass1).ShouldBeTrue();
}