40 lines
1.3 KiB
C#
40 lines
1.3 KiB
C#
using Skeleton.Algebra.Extensions;
|
|
using VirtualChemistry.Chemistry.Atoms.Implements;
|
|
using VirtualChemistry.Chemistry.Atoms.Resolver;
|
|
using VirtualChemistry.Chemistry.Compounds.Implements;
|
|
using VirtualChemistry.Chemistry.Containers;
|
|
using VirtualChemistry.Chemistry.Mixtures.Implements;
|
|
|
|
namespace VirtualChemistryTest;
|
|
|
|
public static class MixtureDegenerateTest
|
|
{
|
|
private class Container : IChemicalContainer
|
|
{
|
|
public Container(HeterogeneousMixture h) => Content = h;
|
|
public double Volume() => 200;
|
|
public HeterogeneousMixture Content { get; set; }
|
|
public double EnvironmentPressure { get; set; }
|
|
public double EnvironmentTemperature { get; set; }
|
|
}
|
|
[Test]
|
|
public static void DegenerateTest()
|
|
{
|
|
HeterogeneousMixture h = new ();
|
|
h.Container = new Container(h);
|
|
HomogeneousMixture m = new();
|
|
h.AddLayer(m);
|
|
BaseAtom a = AtomResolver.Resolve(1);
|
|
BaseAtom a2 = AtomResolver.Resolve(1);
|
|
Compound c1 = a.GrabCompound;
|
|
c1.Amount = 10;
|
|
Compound c2 = a2.GrabCompound;
|
|
c2.Amount = 5;
|
|
m.AddCompound(c1);
|
|
m.AddCompound(c2);
|
|
Assert.That(m.Compounds.Count, Is.EqualTo(1));
|
|
Assert.IsTrue(m.Amount.IsEqualApprox(15));
|
|
}
|
|
}
|
|
|