Exemplo n.º 1
0
        public void Success_ArgumentBinding(
            string pCommandLineTemplate,
            TestConsole pConsoleCommandLine,
            InOutService pInOutService,
            [Frozen] IVendorService pVendorService,
            [Frozen] string pIdCompany)
        {
            // Setup data
            var fCommandLine = string.Format(pCommandLineTemplate,
                                             pIdCompany);

            // Setup services
            var pCommand = new ListVendorsCommand(pVendorService, pInOutService, null);

            // Test
            pCommand.Invoke(fCommandLine, pConsoleCommandLine);

            // Validate
            pConsoleCommandLine.Error.ToString().Should().BeNullOrEmpty();
            pVendorService.Received(1);
            pVendorService.Received().List(
                Arg.Is <string>(x => x.Equals(pIdCompany)));
        }
Exemplo n.º 2
0
        public void Success_ConsolOutput(
            EFormatType pFormat,
            TestConsole pConsoleCommandLine,
            InOutService pInOutService,
            [Frozen] IVendorService pVendorService,
            [Frozen] IList <Vendor> pVendors)
        {
            // Setup data
            pVendorService
            .List(Arg.Any <string>())
            .Returns(pVendors);

            var fCommandLine = $"-c IdCompany -f {pFormat}";

            // Setup services
            var pCommand = new ListVendorsCommand(pVendorService, pInOutService, null);

            // Test
            pCommand.Invoke(fCommandLine, pConsoleCommandLine);

            // Validate
            pConsoleCommandLine.Error.ToString().Should().BeNullOrEmpty();
            pVendorService.Received(1);
        }