public void PrintItemsExemptTest()
        {
            // Arrange
            _fileRepositoryMock
            .Setup(mock => mock.ReadLines(It.IsAny <string>()))
            .Returns(
                new List <string>
            {
                $"print-item1 19.99 {exemptString}",
                "print-item2 29.99",
                $"print-item3 39.99 {exemptString}"
            });

            var jobsFileRepository = new JobsFileRepository(_fileRepositoryMock.Object);

            // Act
            var job = jobsFileRepository.ReadJobFromFile("fakeFilePath");

            // Assert
            var expectedOuput = Job.Create(
                false,
                new List <PrintItem>
            {
                PrintItem.Create("print-item1", 19.99m, true),
                PrintItem.Create("print-item2", 29.99m, false),
                PrintItem.Create("print-item3", 39.99m, true)
            });

            Assert.That(job, Is.EqualTo(expectedOuput).Using(new JobEqualityComparer()));
        }
        public void EmptyFileTest()
        {
            // Arrange
            _fileRepositoryMock
            .Setup(mock => mock.ReadLines(It.IsAny <string>()))
            .Returns(Enumerable.Empty <string>());

            var jobsFileRepository = new JobsFileRepository(_fileRepositoryMock.Object);

            // Act and Assert
            Assert.That(
                () => jobsFileRepository.ReadJobFromFile("fakeFilePath"),
                Throws.TypeOf <InvalidOperationException>());
        }
        public void MissingPrintItemNameTest()
        {
            // Arrange
            _fileRepositoryMock
            .Setup(mock => mock.ReadLines(It.IsAny <string>()))
            .Returns(new List <string> {
                "50.00"
            });

            var jobsFileRepository = new JobsFileRepository(_fileRepositoryMock.Object);

            // Act and Assert
            Assert.That(
                () => jobsFileRepository.ReadJobFromFile("fakeFilePath"),
                Throws.TypeOf <InvalidOperationException>());
        }
        public void OnlyExtraMarginTest()
        {
            // Arrange
            _fileRepositoryMock
            .Setup(mock => mock.ReadLines(It.IsAny <string>()))
            .Returns(new List <string> {
                extraMarginString
            });

            var jobsFileRepository = new JobsFileRepository(_fileRepositoryMock.Object);

            // Act and Assert
            Assert.That(
                () => jobsFileRepository.ReadJobFromFile("fakeFilePath"),
                Throws.TypeOf <ArgumentException>().With.Property("ParamName").EqualTo("printItems"));
        }
        public void TooManyCostsTest()
        {
            // Arrange
            _fileRepositoryMock
            .Setup(mock => mock.ReadLines(It.IsAny <string>()))
            .Returns(new List <string> {
                "print-item1 25.25 50.00 exempt"
            });

            var jobsFileRepository = new JobsFileRepository(_fileRepositoryMock.Object);

            // Act and Assert
            Assert.That(
                () => jobsFileRepository.ReadJobFromFile("fakeFilePath"),
                Throws.TypeOf <InvalidOperationException>());
        }
        public void BasicJobTest()
        {
            // Arrange
            _fileRepositoryMock
            .Setup(mock => mock.ReadLines(It.IsAny <string>()))
            .Returns(new List <string> {
                "print-item1 50.00"
            });

            var jobsFileRepository = new JobsFileRepository(_fileRepositoryMock.Object);

            // Act
            var job = jobsFileRepository.ReadJobFromFile("fakeFilePath");

            // Assert
            var expectedOuput = Job.Create(
                false,
                new List <PrintItem> {
                PrintItem.Create("print-item1", 50.00m, false)
            });

            Assert.That(job, Is.EqualTo(expectedOuput).Using(new JobEqualityComparer()));
        }