public void Should_not_throw_exception() { Mapper.CreateMap<BEntity, B>(); Mapper.CreateMap<AEntity, A>(); Mapper.AssertConfigurationIsValid(); var be = new BEntity(); be.BP1 = 3; be.BP2.Add(new AEntity() { AP1 = 1, AP2 = "hello" }); be.BP2.Add(new AEntity() { AP1 = 2, AP2 = "two" }); var b = Mapper.Map<BEntity, B>(be); var belist = new List<BEntity>(); belist.Add(be); IQueryable<BEntity> bei = belist.AsQueryable(); typeof(Exception).ShouldNotBeThrownBy(() => bei.Project().To<B>()); }
private static bool MasterAction(BEntity op, ILocalBox box) { switch (op.ActionType) { case ActionType.Insert: return box.Insert(op.TableName, op.Value); case ActionType.Delete: return box.Delete(op.TableName, op.Key); case ActionType.Update: if (box.Update(op.TableName, op.Key, op.Value)) { return true; } else { return box.Insert(op.TableName, op.Value); } } throw new Exception(""); }