/// <summary> /// preserve catalogable attributes /// </summary> /// <param name="src"></param> /// <param name="target"></param> /// <returns></returns> public static IServiceDto UpdateService(IServiceDto src, IServiceDto target) { target.BusinessValue = src.BusinessValue; target.Popularity = src.Popularity; return(target); }
/// <summary> /// preserve catalogable attributes /// </summary> /// <param name="src"></param> /// <param name="target"></param> /// <returns></returns> public static IServiceDto UpdateService(ServiceAbbreviatedModel src, IServiceDto target) { target.BusinessValue = src.BusinessValue; target.Popularity = src.Popularity; return(target); }
private void MeasureInternal(IServiceDto dto) { var sw = Stopwatch.StartNew(); Benchmark.DoAction(Cache, dto); sw.Stop(); _results.Add(sw.ElapsedMilliseconds); }
public bool Contains(IServiceDto dto) { var key = dto.GetCacheKey(); using (TimedLock.Lock(_locker)) { return _cache.Contains(key); } }
public void Remove(IServiceDto dto) { var key = dto.GetCacheKey(); using (TimedLock.Lock(_locker)) { _cache.Remove(key); } }
public void Add(IServiceDto dto) { var key = dto.GetCacheKey(); using (TimedLock.Lock(_locker)) { _cache.Add(key, dto); } }
public IServiceDto Fetch(IServiceDto dto) { var key = dto.GetCacheKey(); using (TimedLock.Lock(_locker)) { return _cache[key]; } }
public void Remove(IServiceDto dto) { var dtoType = dto.GetType(); var dtoKey = dto.GetKey(); Dictionary<IDtoKey, IServiceDto> cache; using (LockType(dtoType, out cache)) { cache.Remove(dtoKey); } }
public IServiceDto Fetch(IServiceDto dto) { var dtoType = dto.GetType(); var dtoKey = dto.GetKey(); Dictionary<IDtoKey, IServiceDto> cache; using (LockType(dtoType, out cache)) { return cache[dtoKey]; } }
public bool Contains(IServiceDto dto) { var dtoType = dto.GetType(); var dtoKey = dto.GetKey(); Dictionary<IDtoKey, IServiceDto> cache; using (LockType(dtoType, out cache)) { return cache.ContainsKey(dtoKey); } }
/// <summary> /// Basic list of services /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult ShowServices(int id = 0) { IServiceDto model = null; if (id != 0) { model = _portfolioService.GetService(id); } if (model == null) { model = new ServiceDto { Id = 0 } } ; return(View(model as ServiceDto)); }
public void ServiceController_ModifyService_Create() { //Set up test int statusId = CreateFakeLifecycleStatus(LifecycleStatusName); IServiceDto fakeService = A.Fake <IServiceDto>(); A.CallTo(() => fakeService.Name).Returns(ServiceName); A.CallTo(() => fakeService.LifecycleStatusId).Returns(statusId); //Do Test Action ServiceController controller = new ServiceController(); var result = controller.ModifyService(UserId, fakeService, EntityModification.Create); //Clean up before Assert in case the Assert Fails and you dont reach code beyond it... If you want RemoveFakeService(result.Id); RemoveFakeLifecycleStatus(statusId); //Assert Assert.NotEqual(fakeService.Id, result.Id); }
public static Service MapDtoToService(IServiceDto src) { if (src == null) { return(null); } return(new Service { Id = src.Id, Name = src.Name, Description = src.Description, BusinessValue = src.BusinessValue, BusinessOwner = src.BusinessOwner, ServiceOwner = src.ServiceOwner, LifecycleStatusId = src.LifecycleStatusId, ServiceTypeProvision = src.ServiceTypeProvision, ServiceTypeRole = src.ServiceTypeRole, ServiceBundleId = src.ServiceBundleId, Popularity = src.Popularity }); }
public abstract void DoAction(ICache cache, IServiceDto serviceDto);
public void Add(IServiceDto dto) { var key = dto.GetCacheKey(); _cache.TryAdd(key, dto); }
public bool Contains(IServiceDto dto) { var key = dto.GetCacheKey(); return _cache.ContainsKey(key); }
/// <summary> /// Modifies the service in the database /// </summary> /// <param name="performingUserId">ID for user doing modification</param> /// <param name="service"></param> /// <param name="modification">Type of modification to make</param> /// <returns>Modified entity DTO</returns> public IServiceDto ModifyService(int performingUserId, IServiceDto service, EntityModification modification) { return(_serviceController.ModifyService(performingUserId, service, modification)); }
public void Remove(IServiceDto dto) { var key = dto.GetCacheKey(); _cache.TryRemove(key, out dto); }
public IServiceDto Fetch(IServiceDto dto) { var key = dto.GetCacheKey(); _cache.TryGetValue(key, out dto); return dto; }
public override void DoAction(ICache cache, IServiceDto serviceDto) { cache.Add(serviceDto); }
public override void DoAction(ICache cache, IServiceDto dto) { cache.Contains(dto); }