Ejemplo n.º 1
0
        public void Run_WithNullArgs_InvokesCommandDispatcher()
        {
            // Arrange
            var stubOptionParser  = new Mock <IOptionParser>();
            var listingSubOptions = new ListingSubOptions()
            {
                NameNodeUri = testNameNodeUri, FilePath = new List <string> {
                }
            };

            stubOptionParser.Setup(x => x.ParseOptions(It.IsAny <string[]>())).Returns(listingSubOptions);
            var stubClientProtocol = new Mock <IRestClientProtocol>();

            stubClientProtocol.SetupProperty(x => x.BaseUrl);
            var stubDataTransferProtocol = new Mock <IRestDataTransferProtocol>();
            var mockCommandDispatcher    = new Mock <ICommandDispatcher>();
            var stubCommandFactory       = new Mock <ICommandFactory>();

            var sut = new ClientHost(stubOptionParser.Object, stubClientProtocol.Object, stubDataTransferProtocol.Object, mockCommandDispatcher.Object, stubCommandFactory.Object);

            // Act
            sut.Run(new string[] { });

            // Assert
            mockCommandDispatcher.Verify(x => x.Dispatch(It.IsAny <ICommand>()));
            Assert.AreEqual(testNameNodeUri, stubClientProtocol.Object.BaseUrl.OriginalString);
        }
Ejemplo n.º 2
0
        public void Build_WithListingSubOptionsWithNoFilePath_ReturnsListingCommandWithEmptyFilePath()
        {
            // Arrange
            var listingSubOptions = new ListingSubOptions();

            listingSubOptions.FilePath = new List <string>();

            // Act
            var result = new ListingCommandBuilder().Build(listingSubOptions);

            // Assert
            Assert.IsInstanceOf <ListingCommand>(result);
            var listingCommand = result as ListingCommand;

            Assert.AreEqual("", listingCommand.FilePath);
        }