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));
        }
Exemple #3
0
            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);
            }
        }
Exemple #5
0
 public bool Identical(CloneableStruct other)
 {
     return(value == other.value && tweak == other.tweak);
 }
Exemple #6
0
 public bool Identical(CloneableStruct other)
 {
     return value == other.value && tweak == other.tweak;
 }