public void MethodFactoryShouldReturnCorrectMethodInstance(string flowType, Type methodType) { var factory = new MethodFactory(_loggerMock); IDischargeCalculator method = factory.SelectCalculator(flowType, _settingsMock); Assert.AreEqual(methodType, method.GetType()); }
public void ProcessIncomingData(CrossSectionDataModel data) { if (data == null) { return; } var result = 0f; try { IDischargeCalculator method = _methodFactory.SelectCalculator(data.FlowType, _settings); result = method.Calculate(data); } catch (FloodingException ex) { if (_settings.AlarmFlooding) { _logger.Error(ex); throw; } _logger.Warn(ex); } catch (Exception ex) { _logger.Error(ex); } finally { _repository.SaveReading(data, result); } }