public void IsoMorphismHasUniqueInverse() { Assert.Throws <ArgumentException>(() => Morphism.CreateIso( Product2.Create(1, true), Product2.Create(2, true) )); }
public void IsoMorphism() { var m = Morphism.CreateIso( Product2.Create(0, false), Product2.Create(1, true) ); Assert.Equal(false.ToOption(), m.Apply(0)); Assert.Equal(true.ToOption(), m.Apply(1)); Assert.Equal(0.ToOption(), m.Inverse.Apply(false)); Assert.Equal(1.ToOption(), m.Inverse.Apply(true)); }