public static PositionCalculator GetCalculator(uint desktopWidth, uint desktopHeight, uint hOffset, uint vOffset, uint notificationWidth, ToastrPositions position) { switch (position) { case ToastrPositions.TopRight: return new TopRightPositionCalculator(desktopWidth, desktopHeight, hOffset, vOffset, notificationWidth); case ToastrPositions.TopLeft: return new TopLeftPositionCalculator(desktopWidth, desktopHeight, hOffset, vOffset, notificationWidth); case ToastrPositions.TopFullWidth: return new TopFullWidthPositionCalculator(desktopWidth, desktopHeight, hOffset, vOffset, notificationWidth); case ToastrPositions.TopCenter: return new TopCenterPositionCalculator(desktopWidth, desktopHeight, hOffset, vOffset, notificationWidth); case ToastrPositions.BottomRight: return new BottomRightPositionCalculator(desktopWidth, desktopHeight, hOffset, vOffset, notificationWidth); case ToastrPositions.BottomLeft: return new BottomLeftPositionCalculator(desktopWidth, desktopHeight, hOffset, vOffset, notificationWidth); case ToastrPositions.BottomFullWidth: return new BottomFullWidthPositionCalculator(desktopWidth, desktopHeight, hOffset, vOffset, notificationWidth); case ToastrPositions.BottomCenter: return new BottomCenterPositionCalculator(desktopWidth, desktopHeight, hOffset, vOffset, notificationWidth); default: throw new ArgumentOutOfRangeException(nameof(position), position, $"Position calculator for position '{position}' is not implemented."); } }
public void Get_ShouldSetPositionClass(string value, ToastrPositions expected) { var configuration = _reader.Get(new Dictionary<string, object> { { "positionClass", value } }); Assert.Equal(expected, configuration.PositionClass); }
private PositionCalculator GetCalculator(ToastrPositions position) { return PositionCalculatorFactory.GetCalculator(1024, 768, 20, 10, 300, position); }