Esempio n. 1
0
        /// <summary>
        /// 编辑用户信息
        /// </summary>
        /// <param name="id"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task <Result> EditUserInfo(string id, UserModel model)
        {
            var redis         = this.RedisProvider.GetDatabase();
            var originalModel = redis.JsonGet <UserModel>(TOKEN_KEY + id);
            await redis.StringSetAsync(TOKEN_KEY + id, JsonConvert.SerializeObject(MapperProvider.Map(model, originalModel)));

            return(Result.SuccessResult(model));
        }
        public void IEnumerable_Map_calls_AutoMapper_Map()
        {
            var mapperMock = new Mock <IMapper>();

            mapperMock.Setup(a => a.Map <IEnumerable <ClassA>, IEnumerable <ClassB> >(It.IsAny <IEnumerable <ClassA> >())).Verifiable();
            var sut = new MapperProvider(mapperMock.Object);

            sut.Map <ClassA, ClassB>(new List <ClassA>());
            mapperMock.Verify(a => a.Map <IEnumerable <ClassA>, IEnumerable <ClassB> >(It.IsAny <IEnumerable <ClassA> >()), Times.Once);
        }
Esempio n. 3
0
 public virtual IEnumerable <TDestination> Map <TSource, TDestination>(IEnumerable <TSource> source)
 {
     return(MapperProvider.Map <TSource, TDestination>(source));
 }
Esempio n. 4
0
 public virtual TDestination Map <TSource, TDestination>(TSource source)
 {
     return(MapperProvider.Map <TSource, TDestination>(source));
 }