mirror of
https://github.com/StockSharp/StockSharp.git
synced 2026-12-04 08:32:23 +00:00
"Mark the blocking wrappers obsolete" left several callers of those wrappers under #pragma, because a property, a parameter handler or a state setter could not wait, and a few places that blocked without a wrapper. Each of those chains now runs through callers that can await. The emulation connector. A state change collects what its handlers throw and sends it out once the state lock is released; the disconnect that follows Stopping is awaited there as well. The change to Stopped moved from a handler of Disconnected into OnDisconnectedAsync, a step the connector now awaits before it raises that event. ExpressionIndexSecurity. Expression records the text and reads the instruments it names, which needs no compiler. The formula is compiled by GetFormulaAsync; Formula is an obsolete blocking wrapper over it. IBasketSecurityProcessor gets InitAsync, where the expression processor takes its formula, and CreateProcessorAsync creates a processor and prepares it; CreateProcessor and the IEnumerable ToBasket are obsolete wrappers, and the tests of ToBasket go through the IAsyncEnumerable overload. The index diagram element builds its index in OnPrepareAsync. MathDiagramElement. The inputs are named by the text of the formula; the formula and its validation are compiled in OnPrepareAsync. An element that was reset therefore compiles again at the next start instead of refusing to start. An input that is wired stays while the text is not known to compile, and goes at the preparation if the compiled formula does not name it. A text replaced under a running element is an error on every value until the element is prepared again. Candle patterns. A CandleExpressionCondition compiled its formula in the constructor or, for the registry, at the first evaluation. The formula is now compiled by PrepareAsync: on the condition, on ICandlePattern and, through the new IIndicator.PrepareAsync, on the indicator that holds a pattern. A pattern that was not prepared refuses to recognize instead of compiling on the spot. The checks of a pattern as a whole - a formula reaching outside it, no formulas at all - moved from the first Recognize to the preparation, and a failed check no longer leaves the pattern marked as checked. Whoever feeds an indicator prepares it first: IndicatorDiagramElement in OnPrepareAsync, a strategy for the indicators its start registered, the chart samples when an indicator is added. ICandlePatternProvider.Save became SaveAsync and prepares the pattern before it stores it. The compileOnDemand constructor is gone: no constructor compiles. Stopping a strategy from code that cannot wait. When an element was entered deeper than the overflow limit, DiagramElement.Process stopped the strategy through AsyncHelper.Run. Strategy gets RequestStop for such code: it reports the error, refuses new orders at once and leaves the stop itself to OnNewMessage, which carries it out when the connector hands over the next message. Releasing a connector. Connector.DisposeManaged waited for the disconnect, and for the message that takes the adapters apart, through AsyncHelper.Run. The release is now DisposeManagedAsync, a virtual chain that the connectors derived from Connector override. DisposeAsync awaits it, and the sealed DisposeManaged is the same chain with the caller blocked, as IDisposable requires. IConnector is IAsyncDisposable, so code that holds a connector by its interface releases it by await as well. Diagram elements that waited for their type. A composition read before one of its element types was registered keeps an empty node for each such element. Registering the type started their load unawaited, and a failure lost the settings at the next save. ICompositionRegistry gets LoadNotLoadedElementsAsync, to be awaited by whoever registered the types. It loads what waits in the given composition and in the compositions nested in it, one call at a time. The settings of an element that waits are kept by its node (ICompositionModelNode.ElementSettings). A loaded element joins its model: it is announced as an added one and the links of its node are connected. The sample windows. CombineHistoryRealtime, LiveTerminal and StoreDataLocal, WPF and Avalonia, flushed the storage executor, released the CSV registries and read them at startup through AsyncHelper.Run. A window now refuses the first attempt to close it, awaits the release and closes itself once the queued writes are on the disk. A shutdown that does not honour the refusal - the end of the Windows session, Application.Shutdown - is not waited for: what is still queued then is lost. LiveOptionsQuoting and MultiConnect called the blocking Strategy.Start, Stop and GetTimeFrames under a suppressed obsolete warning; they await the async ones now. What the rework uncovered: - Pausing the optimizer. An iteration that had passed the pause gate but whose connector had not started replaying yet ran to its end through the pause; cloning the strategy asynchronously made that window long enough for PauseHaltsBruteForce to see it on CI. An iteration now waits for its connector to come up and suspends it if the optimizer is paused by then. - Undo of diagram elements. An undo scope opened with no undo manager in sight took the element's level down when it closed, so the level was negative by the time the element reached a composition and no edit was ever reported. The scope remembers whether it was counted. - Undo of a chart panel. A snapshot keeps the series and axes of a panel by reference, since a part can only be saved asynchronously, so undo did not put back what a part was set to. IChartSnapshotPart is an optional interface for a part that can copy its settings in memory; the panel captures and gives back the settings of such parts. No chart part implements it yet - that is for the chart packages to do. - The dummy indicator wrapper was left without a chart element, so indicator values could not be wired into the panel that a run without a window uses. - Settings loaded before a composition existed are applied when the strategy starts; a test pins it. - AsyncMessageChannel looked at its state once per wake-up and then went through the queue until it was empty, so a message sent right after Suspend returned could still be started, and Suspend_PausesProcessing was red from time to time. The state is now read under the queue lock, where the next message is picked; a channel that is being closed stops starting what is queued the same way. DiagramElementParamTests no longer declares a value that persists itself through the obsolete IPersistable: declaring one needs a suppressed warning, and for that contract the parameter relies on SaveEntireAsync and LoadEntireAsync of Ecng, which are tested there.
494 lines
16 KiB
C#
494 lines
16 KiB
C#
namespace StockSharp.Tests;
|
|
|
|
using System.ComponentModel;
|
|
|
|
using StockSharp.Charting;
|
|
using StockSharp.Diagram;
|
|
using StockSharp.Diagram.Elements;
|
|
|
|
/// <summary>
|
|
/// The behaviour is the store a diagram host reads and writes its graph through, and its notifications are
|
|
/// the only way that host learns the graph moved on. What it owes is therefore not a particular constant
|
|
/// on an event but an answer that is current by the time it is given: which links are still there, which
|
|
/// node has to be read again, and whether the diagram changed at all.
|
|
/// </summary>
|
|
[TestClass]
|
|
public class InMemoryCompositionModelBehaviorTests : BaseTestClass
|
|
{
|
|
/// <summary>
|
|
/// A behaviour with the model a host actually reads it through, and the one call a test needs to put
|
|
/// an element into it.
|
|
/// </summary>
|
|
private sealed class Graph
|
|
{
|
|
public Graph()
|
|
{
|
|
Behavior = new();
|
|
Model = new(Behavior);
|
|
}
|
|
|
|
public InMemoryCompositionModelBehavior Behavior { get; }
|
|
public CompositionModel<InMemoryCompositionModelNode, InMemoryCompositionModelLink> Model { get; }
|
|
|
|
public InMemoryCompositionModelNode Add(DiagramElement element)
|
|
{
|
|
var node = new InMemoryCompositionModelNode { Element = element };
|
|
Model.AddNode(node);
|
|
return node;
|
|
}
|
|
}
|
|
|
|
private static string SocketId(StaticSocketIds id) => id.ToString();
|
|
|
|
private sealed class UndoManagerStub : IUndoManager
|
|
{
|
|
public bool IsUndoingRedoing { get; set; }
|
|
|
|
public bool CanUndo() => false;
|
|
public bool CanRedo() => false;
|
|
|
|
public void Undo()
|
|
{
|
|
}
|
|
|
|
public void Redo()
|
|
{
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// A source of values of one type, so a chart panel has something to be wired to.
|
|
/// </summary>
|
|
private sealed class SourceElement : DiagramElement
|
|
{
|
|
public SourceElement(DiagramSocketType type)
|
|
=> AddOutput(StaticSocketIds.Output, "Out", type);
|
|
|
|
public override Guid TypeId { get; } = "6A3D6B0E-51C4-4F7B-8E0A-2C1D9F4B7A35".To<Guid>();
|
|
|
|
public override string IconName { get; } = "Pi";
|
|
}
|
|
|
|
/// <summary>
|
|
/// An axis that reports a change of its title the way the axis of a real chart does.
|
|
/// </summary>
|
|
private class NotifyingAxis : IChartAxis
|
|
{
|
|
private string _title;
|
|
|
|
public event PropertyChangingEventHandler PropertyChanging;
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
public IChartArea ChartArea => null;
|
|
public string Id { get; set; }
|
|
public bool IsVisible { get; set; }
|
|
|
|
public string Title
|
|
{
|
|
get => _title;
|
|
set
|
|
{
|
|
if (_title == value)
|
|
return;
|
|
|
|
PropertyChanging?.Invoke(this, new(nameof(Title)));
|
|
_title = value;
|
|
PropertyChanged?.Invoke(this, new(nameof(Title)));
|
|
}
|
|
}
|
|
|
|
public string Group { get; set; }
|
|
public bool SwitchAxisLocation { get; set; }
|
|
public ChartAxisType AxisType { get; set; }
|
|
public bool AutoRange { get; set; }
|
|
public bool FlipCoordinates { get; set; }
|
|
public bool DrawMajorTicks { get; set; }
|
|
public bool DrawMajorGridLines { get; set; }
|
|
public bool DrawMinorTicks { get; set; }
|
|
public bool DrawMinorGridLines { get; set; }
|
|
public bool DrawLabels { get; set; }
|
|
public string TextFormatting { get; set; }
|
|
public string CursorTextFormatting { get; set; }
|
|
public string SubDayTextFormatting { get; set; }
|
|
public TimeZoneInfo TimeZone { get; set; }
|
|
|
|
public Task LoadAsync(SettingsStorage storage, CancellationToken cancellationToken)
|
|
=> Task.CompletedTask;
|
|
|
|
public Task SaveAsync(SettingsStorage storage, CancellationToken cancellationToken)
|
|
=> Task.CompletedTask;
|
|
|
|
void INotifyPropertyChangedEx.NotifyPropertyChanged(string propertyName)
|
|
=> PropertyChanged?.Invoke(this, new(propertyName));
|
|
}
|
|
|
|
/// <summary>
|
|
/// An axis that can also copy its settings in memory.
|
|
/// </summary>
|
|
private sealed class SnapshotAxis : NotifyingAxis, IChartSnapshotPart
|
|
{
|
|
object IChartSnapshotPart.CaptureSettings() => Title;
|
|
|
|
void IChartSnapshotPart.RestoreSettings(object settings) => Title = (string)settings;
|
|
}
|
|
|
|
/// <summary>
|
|
/// A composition with an undo manager that keeps the operations it is handed.
|
|
/// </summary>
|
|
private sealed class UndoGraph
|
|
{
|
|
private readonly UndoManagerStub _undoManager = new();
|
|
|
|
public UndoGraph()
|
|
{
|
|
var behavior = new InMemoryCompositionModelBehavior { UndoManager = _undoManager };
|
|
|
|
behavior.BehaviorChanged += change =>
|
|
{
|
|
if (change.oldValue is IUndoableEdit edit)
|
|
Edits.Add(edit);
|
|
};
|
|
|
|
Model = new(behavior);
|
|
Composition = new(Model);
|
|
}
|
|
|
|
public CompositionModel<InMemoryCompositionModelNode, InMemoryCompositionModelLink> Model { get; }
|
|
public CompositionDiagramElement Composition { get; }
|
|
public List<IUndoableEdit> Edits { get; } = [];
|
|
|
|
public InMemoryCompositionModelNode Add(DiagramElement element)
|
|
{
|
|
var node = new InMemoryCompositionModelNode { Element = element };
|
|
Model.AddNode(node);
|
|
return node;
|
|
}
|
|
|
|
public void Undo()
|
|
{
|
|
_undoManager.IsUndoingRedoing = true;
|
|
|
|
try
|
|
{
|
|
foreach (var edit in Edits.AsEnumerable().Reverse())
|
|
edit.Undo();
|
|
}
|
|
finally
|
|
{
|
|
_undoManager.IsUndoingRedoing = false;
|
|
}
|
|
}
|
|
|
|
public void Redo()
|
|
{
|
|
_undoManager.IsUndoingRedoing = true;
|
|
|
|
try
|
|
{
|
|
foreach (var edit in Edits)
|
|
edit.Redo();
|
|
}
|
|
finally
|
|
{
|
|
_undoManager.IsUndoingRedoing = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// A link names the socket it lands on, and an element may give that socket up and take it back - a
|
|
/// limit order has a price input, a market order has none. When the socket returns the link must be
|
|
/// honoured: the model has to expose its far end again, and the host has to be told which node to read
|
|
/// again, or the diagram is drawn with a link nobody can follow.
|
|
/// </summary>
|
|
[TestMethod]
|
|
public void SocketAdded_InvalidatesTheRelationshipsTheModelExposes()
|
|
{
|
|
var graph = new Graph();
|
|
|
|
var source = new OrderRegisterDiagramElement();
|
|
var target = new OrderRegisterDiagramElement { IsMarket = true };
|
|
|
|
var sourceNode = graph.Add(source);
|
|
var targetNode = graph.Add(target);
|
|
|
|
var orderId = SocketId(StaticSocketIds.Order);
|
|
var priceId = SocketId(StaticSocketIds.Price);
|
|
|
|
target.InputSockets.FindById(priceId).AssertNull("a market order element has no price input for a link to land on");
|
|
|
|
graph.Model.AddLink(sourceNode, orderId, targetNode, priceId);
|
|
|
|
InMemoryCompositionModelNode invalidated = null;
|
|
|
|
graph.Behavior.BehaviorChanged += t =>
|
|
{
|
|
if (t.change == ModelChange.InvalidateRelationships)
|
|
invalidated = (InMemoryCompositionModelNode)t.data;
|
|
};
|
|
|
|
target.IsMarket = false;
|
|
|
|
var price = target.InputSockets.FindById(priceId);
|
|
|
|
price.AssertNotNull("a limit order element must have its price input back");
|
|
invalidated.AssertSame(targetNode, "the node that gained the socket is the one whose relationships have to be read again");
|
|
graph.Behavior.Links.Count().AssertEqual(1, "a link whose socket came back leads somewhere again and must be kept");
|
|
|
|
((ICompositionModel)graph.Model).GetConnectedSocketsFor(target, price).Single()
|
|
.AssertSame(source.OutputSockets.FindById(orderId), "the model must expose the far end of the link once the socket it lands on exists");
|
|
}
|
|
|
|
/// <summary>
|
|
/// The mirror promise. A socket an element gives up leaves the link that landed on it pointing nowhere,
|
|
/// so the model must stop exposing that link - and must have stopped before the host is told the node
|
|
/// changed, or the host reads the node back and is handed the relationship that has just died.
|
|
/// </summary>
|
|
[TestMethod]
|
|
public void SocketRemoved_DropsTheLinkThatLandedOnIt_BeforeTheNodeIsAnnouncedAsChanged()
|
|
{
|
|
var graph = new Graph();
|
|
|
|
// Both are limit order elements, so the target has a price input for the link to land on.
|
|
var source = new OrderRegisterDiagramElement();
|
|
var target = new OrderRegisterDiagramElement();
|
|
|
|
var sourceNode = graph.Add(source);
|
|
var targetNode = graph.Add(target);
|
|
|
|
var orderId = SocketId(StaticSocketIds.Order);
|
|
var priceId = SocketId(StaticSocketIds.Price);
|
|
|
|
graph.Model.AddLink(sourceNode, orderId, targetNode, priceId);
|
|
|
|
graph.Behavior.Links.Count().AssertEqual(1, "the link must be in the model before the socket goes");
|
|
|
|
InMemoryCompositionModelNode invalidated = null;
|
|
var linksWhenAnnounced = -1;
|
|
|
|
graph.Behavior.BehaviorChanged += t =>
|
|
{
|
|
if (t.change != ModelChange.InvalidateRelationships)
|
|
return;
|
|
|
|
invalidated = (InMemoryCompositionModelNode)t.data;
|
|
linksWhenAnnounced = graph.Behavior.GetLinksForNode(invalidated).Count();
|
|
};
|
|
|
|
target.IsMarket = true;
|
|
|
|
target.InputSockets.FindById(priceId).AssertNull("a market order element has no price input");
|
|
invalidated.AssertSame(targetNode, "the node that lost the socket is the one whose relationships have to be read again");
|
|
graph.Behavior.Links.Count().AssertEqual(0, "a link that lands nowhere must stop being part of the graph");
|
|
linksWhenAnnounced.AssertEqual(0, "the dead link must already be gone when the host is told to read the node again");
|
|
}
|
|
|
|
/// <summary>
|
|
/// A host keeps a diagram it can save and redraw, and the model is the only place it learns the diagram
|
|
/// moved on. An edit committed on an element is such a move: it must reach the host, and it must name
|
|
/// the node and the operation so the right part can be redrawn or undone. Turning editing off changes
|
|
/// nothing anyone could save, so it must not be announced as a change of the diagram.
|
|
/// </summary>
|
|
[TestMethod]
|
|
public void CommittedElementEdit_IsAnnouncedAsAChangeOfTheDiagram_AndEditabilityIsNot()
|
|
{
|
|
var graph = new Graph();
|
|
var node = graph.Add(new OrderRegisterDiagramElement());
|
|
|
|
var changes = 0;
|
|
graph.Model.ModelChanged += () => changes++;
|
|
|
|
object edited = null;
|
|
string operation = null;
|
|
|
|
graph.Behavior.BehaviorChanged += t =>
|
|
{
|
|
if (t.change != ModelChange.Property)
|
|
return;
|
|
|
|
edited = t.data;
|
|
operation = t.propName;
|
|
};
|
|
|
|
graph.Behavior.RaiseCommited("op", node, null);
|
|
|
|
changes.AssertEqual(1, "an edit committed on an element is a change of the diagram and must reach the host");
|
|
edited.AssertSame(node, "the announcement must name the node that was edited");
|
|
operation.AssertEqual("op", "the announcement must name the operation that was committed");
|
|
|
|
graph.Behavior.Modifiable = false;
|
|
|
|
changes.AssertEqual(1, "turning editing off changes nothing that could be saved, so it is not a change of the diagram");
|
|
}
|
|
|
|
/// <summary>
|
|
/// An element is built - sockets added, parameters given their defaults - before it is put into a
|
|
/// composition, so before any undo manager is in sight. What it did then must not count against
|
|
/// the edits made once there is one.
|
|
/// </summary>
|
|
[TestMethod]
|
|
public void ParameterEdit_ReachesTheUndoManager_AndCanBeUndoneAndRedone()
|
|
{
|
|
var graph = new UndoGraph();
|
|
var variable = new VariableDiagramElement();
|
|
graph.Add(variable);
|
|
graph.Edits.Clear();
|
|
|
|
variable.InputAsTrigger.AssertFalse();
|
|
variable.InputAsTrigger = true;
|
|
|
|
IsTrue(graph.Edits.Count > 0, "an edit of a parameter must be handed to the undo manager");
|
|
|
|
graph.Undo();
|
|
variable.InputAsTrigger.AssertFalse("undo puts the parameter back");
|
|
|
|
graph.Redo();
|
|
variable.InputAsTrigger.AssertTrue("redo makes the edit again");
|
|
}
|
|
|
|
/// <summary>
|
|
/// An edit made while the manager is undoing or redoing is the manager's own work and is not
|
|
/// reported back to it as a new operation.
|
|
/// </summary>
|
|
[TestMethod]
|
|
public void Undo_WhatItChangesItself_IsNotReportedAsANewEdit()
|
|
{
|
|
var graph = new UndoGraph();
|
|
var variable = new VariableDiagramElement();
|
|
graph.Add(variable);
|
|
graph.Edits.Clear();
|
|
|
|
variable.InputAsTrigger = true;
|
|
var reported = graph.Edits.Count;
|
|
|
|
graph.Undo();
|
|
graph.Redo();
|
|
|
|
graph.Edits.Count.AssertEqual(reported);
|
|
|
|
variable.InputAsTrigger = false;
|
|
|
|
IsTrue(graph.Edits.Count > reported, "an edit made after an undo and a redo is reported like any other");
|
|
}
|
|
|
|
/// <summary>
|
|
/// A security is held by reference: the element, the provider and the connector all mean the same
|
|
/// object. Undo must hand that object back, not a copy nobody else holds.
|
|
/// </summary>
|
|
[TestMethod]
|
|
public void Undo_LeavesTheSecurityAnElementHolds_TheSameObject()
|
|
{
|
|
var security = new Security { Id = "AAPL@NASDAQ" };
|
|
|
|
var graph = new UndoGraph();
|
|
var variable = new VariableDiagramElement { Type = DiagramSocketType.Security, Value = security };
|
|
graph.Add(variable);
|
|
graph.Edits.Clear();
|
|
|
|
variable.InputAsTrigger = true;
|
|
IsTrue(graph.Edits.Count > 0, "an edit of a parameter must be handed to the undo manager");
|
|
|
|
graph.Undo();
|
|
|
|
variable.InputAsTrigger.AssertFalse();
|
|
AreSame(security, variable.Value);
|
|
|
|
graph.Redo();
|
|
|
|
AreSame(security, variable.Value);
|
|
}
|
|
|
|
/// <summary>
|
|
/// A chart panel keeps an indicator series inside a wrapper. Undo of an edit of the panel leaves
|
|
/// the series on it once, in the wrapper it already had.
|
|
/// </summary>
|
|
[TestMethod]
|
|
public void Undo_OfAChartPanelEdit_KeepsOneWrapperPerIndicator()
|
|
{
|
|
var graph = new UndoGraph();
|
|
|
|
var source = new SourceElement(DiagramSocketType.IndicatorValue);
|
|
var panel = new DummyChartDiagramElement();
|
|
|
|
var sourceNode = graph.Add(source);
|
|
var panelNode = graph.Add(panel);
|
|
|
|
graph.Model.AddLink(sourceNode, StaticSocketIds.Output.ToString(), panelNode, panel.InputSockets.First().Id);
|
|
|
|
panel.IndicatorElements.Count.AssertEqual(1, "wiring indicator values into a panel puts an indicator series on it");
|
|
var wrapper = panel.IndicatorElements.First();
|
|
|
|
graph.Edits.Clear();
|
|
panel.ShowNonFormedIndicators = !panel.ShowNonFormedIndicators;
|
|
IsTrue(graph.Edits.Count > 0, "an edit of a panel parameter must be handed to the undo manager");
|
|
|
|
graph.Undo();
|
|
|
|
panel.IndicatorElements.Count.AssertEqual(1, "undo must not put a second wrapper around the same series");
|
|
AreSame(wrapper, panel.IndicatorElements.First());
|
|
|
|
graph.Redo();
|
|
|
|
panel.IndicatorElements.Count.AssertEqual(1);
|
|
AreSame(wrapper, panel.IndicatorElements.First());
|
|
}
|
|
|
|
/// <summary>
|
|
/// A series or an axis of a panel is edited in place, and the edit is one of the panel. Undo has to
|
|
/// put back what the part was set to, and redo what it was changed to - for a part that can copy its
|
|
/// settings in memory, since a snapshot is taken where nothing can wait for a part to be saved.
|
|
/// </summary>
|
|
[TestMethod]
|
|
public void Undo_OfAnAxisEdit_PutsBackWhatTheAxisWasSetTo()
|
|
{
|
|
var graph = new UndoGraph();
|
|
var panel = new DummyChartDiagramElement();
|
|
graph.Add(panel);
|
|
|
|
var axis = new SnapshotAxis { Id = "Y2", Title = "price" };
|
|
panel.YAxes.Add(axis);
|
|
|
|
graph.Edits.Clear();
|
|
axis.Title = "volume";
|
|
IsTrue(graph.Edits.Count > 0, "an edit of an axis must be handed to the undo manager as an edit of its panel");
|
|
|
|
graph.Undo();
|
|
|
|
axis.Title.AssertEqual("price", "undo must put back what the axis was set to");
|
|
IsTrue(panel.YAxes.Contains(axis), "the axis itself stays on the panel");
|
|
|
|
graph.Redo();
|
|
|
|
axis.Title.AssertEqual("volume", "redo must put back what the axis was changed to");
|
|
}
|
|
|
|
/// <summary>
|
|
/// The parts of a chart come from the chart package the application was built with, and one built
|
|
/// before a part could copy its settings has parts that cannot. Such a part has to stay on its panel
|
|
/// through undo and redo of its own edit.
|
|
/// </summary>
|
|
[TestMethod]
|
|
public void Undo_OfAnAxisThatCannotCopyItsSettings_KeepsItOnThePanel()
|
|
{
|
|
var graph = new UndoGraph();
|
|
var panel = new DummyChartDiagramElement();
|
|
graph.Add(panel);
|
|
|
|
var axis = new NotifyingAxis { Id = "Y2", Title = "price" };
|
|
panel.YAxes.Add(axis);
|
|
var axes = panel.YAxes.ToArray();
|
|
|
|
graph.Edits.Clear();
|
|
axis.Title = "volume";
|
|
IsTrue(graph.Edits.Count > 0, "an edit of an axis must be handed to the undo manager as an edit of its panel");
|
|
|
|
graph.Undo();
|
|
|
|
panel.YAxes.ToArray().AssertEqual(axes, "undo must leave the panel with the axes it had");
|
|
|
|
graph.Redo();
|
|
|
|
panel.YAxes.ToArray().AssertEqual(axes, "redo must leave the panel with the axes it had");
|
|
}
|
|
}
|