Beispiel #1
0
        public static async Task ShouldAddNode <TNode>(this IMixerViewModel mixer,
                                                       Point point,
                                                       IInteractionService interactions,
                                                       INodeFactory nodeFactory,
                                                       Func <IMixerViewModel, Task> command)
            where TNode : INode
        {
            // Arrange

            var isInvoked = false;

            interactions.GetNewNodePoint
            .RegisterHandler(i =>
            {
                isInvoked = true;
                i.SetOutput(point);
            });
            // Act

            mixer.Activator
            .Activate();

            await command(mixer);

            var node = mixer.Nodes.Single();

            // Assert

            isInvoked.Should().BeTrue();

            nodeFactory.Received().Create <TNode>();

            node.Should().BeAssignableTo <TNode>();

            node.X.Should().Be(point.X);
            node.Y.Should().Be(point.Y);
        }