public void Create_WithMessages_ReturnOnlyWarningAndErrorMacroStabilityInwardsKernelMessages() { // Setup Message[] logMessages = { CreateMessage(MessageType.Info, "Calculation Info"), CreateMessage(MessageType.Warning, "Calculation Warning"), CreateMessage(MessageType.Error, "Calculation Error") }; // Call IEnumerable <MacroStabilityInwardsKernelMessage> kernelMessages = MacroStabilityInwardsKernelMessagesCreator.Create(logMessages); // Assert Assert.AreEqual(2, kernelMessages.Count()); MacroStabilityInwardsKernelMessage firstMessage = kernelMessages.ElementAt(0); Assert.AreEqual("Calculation Warning", firstMessage.Message); Assert.AreEqual(MacroStabilityInwardsKernelMessageType.Warning, firstMessage.Type); MacroStabilityInwardsKernelMessage secondMessage = kernelMessages.ElementAt(1); Assert.AreEqual("Calculation Error", secondMessage.Message); Assert.AreEqual(MacroStabilityInwardsKernelMessageType.Error, secondMessage.Type); }
public void Create_MessagesNull_ThrowsArgumentNullException() { // Call void Call() => MacroStabilityInwardsKernelMessagesCreator.Create(null); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("messages", exception.ParamName); }
public IEnumerable <MacroStabilityInwardsKernelMessage> Validate() { try { IUpliftVanKernel upliftVanKernel = CreateUpliftVanKernel(); return(MacroStabilityInwardsKernelMessagesCreator.Create(upliftVanKernel.Validate().ToArray())); } catch (UpliftVanKernelWrapperException e) { throw new UpliftVanCalculatorException(e.Message, e); } }
public IEnumerable <MacroStabilityInwardsKernelMessage> Validate() { IWaternetKernel waternetKernel = GetWaternetKernel(); try { return(MacroStabilityInwardsKernelMessagesCreator.Create(waternetKernel.Validate().ToArray())); } catch (WaternetKernelWrapperException e) { throw new WaternetCalculatorException(e.Message, e); } }
private IUpliftVanKernel CalculateUpliftVan() { IUpliftVanKernel upliftVanKernel = CreateUpliftVanKernel(); try { upliftVanKernel.Calculate(); } catch (UpliftVanKernelWrapperException e) { throw new UpliftVanCalculatorException(e.Message, e, MacroStabilityInwardsKernelMessagesCreator.Create(e.Messages)); } return(upliftVanKernel); }
public UpliftVanCalculatorResult Calculate() { IUpliftVanKernel upliftVanKernel = CalculateUpliftVan(); return(new UpliftVanCalculatorResult( UpliftVanSlidingCurveResultCreator.Create(upliftVanKernel.SlidingCurveResult), UpliftVanCalculationGridResultCreator.Create(upliftVanKernel.UpliftVanCalculationGridResult), MacroStabilityInwardsKernelMessagesCreator.Create(upliftVanKernel.CalculationMessages), new UpliftVanCalculatorResult.ConstructionProperties { FactorOfStability = upliftVanKernel.FactorOfStability, ForbiddenZonesXEntryMin = upliftVanKernel.ForbiddenZonesXEntryMin, ForbiddenZonesXEntryMax = upliftVanKernel.ForbiddenZonesXEntryMax })); }
public void Create_MessageTextNull_ReturnsMacroStabilityInwardsKernelMessageWithUnknownText() { // Setup Message[] logMessages = { CreateMessage(MessageType.Error, null) }; // Call IEnumerable <MacroStabilityInwardsKernelMessage> kernelMessages = MacroStabilityInwardsKernelMessagesCreator.Create(logMessages); // Assert MacroStabilityInwardsKernelMessage kernelMessage = kernelMessages.Single(); Assert.AreEqual("Onbekend", kernelMessage.Message); Assert.AreEqual(MacroStabilityInwardsKernelMessageType.Error, kernelMessage.Type); }