public void ReturnInstance_WhenProvidedValidParameters()
        {
            //Arrange
            var stubProductService = new Mock <IProductService>();
            var stubPDFExporter    = new Mock <IPDFExporter>();

            //Act
            var testedCommand = new PrintAvailableProductReportCommand(stubProductService.Object, stubPDFExporter.Object);

            //Assert
            Assert.IsInstanceOfType(testedCommand, typeof(PrintAvailableProductReportCommand));
        }
        public void ShouldReturn_CorrectMessage()
        {
            //Arrange
            var stubProductService = new Mock <IProductService>();
            var stubPDFExporter    = new Mock <IPDFExporter>();
            var testedCommand      = new PrintAvailableProductReportCommand(stubProductService.Object, stubPDFExporter.Object);
            var expectedResult     = "Export products successful!";
            //Act
            var returnedResult = testedCommand.ExecuteThisCommand();

            //Assert
            Assert.AreEqual(expectedResult, returnedResult);
        }
        public void Invoke_ProductServiceGetAll()
        {
            //Arrange
            var mockProductService = new Mock <IProductService>();
            var stubPDFExporter    = new Mock <IPDFExporter>();

            //Act
            var testedCommand = new PrintAvailableProductReportCommand(mockProductService.Object, stubPDFExporter.Object);

            testedCommand.ExecuteThisCommand();
            //Assert
            mockProductService.Verify(x => x.GetAllProducts(), Times.Once);
        }
        public void Invoke_PDFExporterExportProducts()
        {
            //Arrange
            var stubProductService = new Mock <IProductService>();
            var mockPDFExporter    = new Mock <IPDFExporter>();
            var fakeCollection     = new List <IProductModel>().AsEnumerable();
            var testedCommand      = new PrintAvailableProductReportCommand(stubProductService.Object, mockPDFExporter.Object);

            //Act
            testedCommand.ExecuteThisCommand();

            //Assert
            mockPDFExporter.Verify(x => x.ExportProducts(fakeCollection), Times.Once);
        }