public void when_asing_a_struct_to_an_interface() { var cloneable = new CloneableStruct("not default"); var properCast = cloneable as ICloneable; properCast.Should().NotBeNull(); properCast.Should().NotBe(default(CloneableStruct)); }
public bool Show() { var st = new CloneableStruct(1, true, "test"); var clone = (CloneableStruct)st.Clone(); st.Field3 = "some string"; return(Equals(st, clone)); }
public override bool Equals(object other) { if (!(other is CloneableStruct)) { return(false); } CloneableStruct o = (CloneableStruct)other; return(o.value == value); }
public void ShouldCacheACustomStructCreationFactory() { using (var mapper = Mapper.CreateNew()) { mapper.WhenMapping .From <CloneableStruct>() .ToANew <CloneableStruct>() .CreateInstancesUsing(ctx => ctx.Source.Clone()); mapper.GetPlanFor <CloneableStruct>().ToANew <CloneableStruct>(); var source = new CloneableStruct { Value = 123 }; var result = mapper.Map(source).ToANew <CloneableStruct>(); result.Value.ShouldBe(123); } }
public bool Identical(CloneableStruct other) { return(value == other.value && tweak == other.tweak); }
public bool Identical(CloneableStruct other) { return value == other.value && tweak == other.tweak; }