public void OverrideRates(ProductTypeDto productTypeDto) { CheckAccessRights(productTypeDto.BusinessId); if (Cache.Business.TryGetValue(productTypeDto.BusinessId) == null) { throw new ValidationException(ErrorFactory.CreateAndLogError(Errors.SRVEX30001, "PropertyManagementSystemService.OverrideRates", additionalDescriptionParameters: (new object[] { productTypeDto.BusinessId }))); } rateCacheManager.OverrideRates(Mapper.Map<ProductType>(productTypeDto)); }
public void OverrideRatesIsSuccessful() { // Arrange const long BUSINESS_ID = 1; var productTypeDto = new ProductTypeDto { BusinessId = BUSINESS_ID }; // Stub the BusinessCache to be used by our service method CacheHelper.StubBusinessCacheSingleBusiness(BUSINESS_ID); var rateCacheManager = MockRepository.GenerateMock<IRateCacheManager>(); PropertyManagementSystemService.RateCacheManager = rateCacheManager; rateCacheManager.Expect(r => r.OverrideRates(Arg<ProductType>.Is.Anything)).Repeat.Once(); // Act PropertyManagementSystemService.OverrideRates(productTypeDto); // Assert rateCacheManager.VerifyAllExpectations(); }