Ejemplo n.º 1
0
        public void ListImages_Success()
        {
            IActorRef client = CreateClient();

            client.Tell(
                new ListImages(
                    correlationId: nameof(ListImages_Success)
                    )
                );
            ConnectionTestProbe.ExpectMsg <Connection.ExecuteCommand>(executeCommand =>
            {
                Assert.IsType <ListImages>(executeCommand.RequestMessage);
                Assert.Equal(
                    expected: nameof(ListImages_Success),
                    actual: executeCommand.CorrelationId
                    );
                Assert.Equal(
                    expected: nameof(ListImages_Success),
                    actual: executeCommand.RequestMessage.CorrelationId
                    );

                ConnectionTestProbe.Reply(new ImageList(executeCommand.CorrelationId,
                                                        images: Enumerable.Empty <ImagesListResponse>()
                                                        ));
            });

            ExpectMsg <ImageList>(imageList =>
            {
                Assert.Equal(
                    expected: nameof(ListImages_Success),
                    actual: imageList.CorrelationId
                    );
                Assert.Equal(0, imageList.Images.Count);
            });
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Stream events to the specified actor.
        /// </summary>
        /// <param name="target">
        ///     The actor that will receive the events.
        /// </param>
        /// <param name="events">
        ///     The <see cref="DockerEvent"/>s to be streamed (existing correlation Ids, if any, will be preserved).
        /// </param>
        void StreamEvents(IActorRef target, params DockerEvent[] events)
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

            if (events == null)
            {
                throw new ArgumentNullException(nameof(events));
            }

            ConnectionTestProbe.ExpectMsg <Connection.ExecuteCommand>(executeCommand =>
            {
                Assert.IsType <MonitorContainerEvents>(executeCommand.RequestMessage);

                ConnectionTestProbe.ActorOf(
                    DockerEventParser.Create(
                        correlationId: target.Path.Name,
                        owner: target,
                        stream: CreateEventStream(events)
                        ),
                    name: DockerEventParser.ActorName
                    );
            });
        }
Ejemplo n.º 3
0
        public void Create_SendsNoMessageToConnection()
        {
            IActorRef client = CreateClient();

            ConnectionTestProbe.ExpectNoMsg();
        }