public void Result_marked_immutable_not_cloned() { var result = new MyImmutable(); var result2 = ApplyStrategy(result, new object()); Assert.AreEqual(result, result2); }
// modify this method as shown public MyImmutable Apply(Func <decimal, decimal, decimal> aggFunc, MyImmutable y) { var aggregated = new Dictionary <ImmutableKey, decimal>(AllKeys.Count()); foreach (ImmutableKey bt in AllKeys) { aggregated[bt] = aggFunc(this[bt], y[bt]); } return(GetNew(aggregated)); }
public void ImmutableFromContent() { var node = new ConstructionNode(typeof(MyImmutable)) { InjectableArguments = new[] { "Hola" } }; var myImmutable = new MyImmutable("Hola"); var fixture = Create(node); Assert.Equal(myImmutable, fixture.Result); }
protected bool Equals(MyImmutable other) { return(string.Equals(arg, other.arg)); }