コード例 #1
0
        public void WriteDataTest_InvalidFile_ReturnsFalse()
        {
            _helperMock.Setup(x => x.FileExists(It.IsAny <string>())).Returns(false);

            var obj    = new CSVProcessorRepository(_logger.Object, _helperMock.Object);
            var actual = obj.WriteData(null, null);

            Assert.IsFalse(actual);
        }
コード例 #2
0
        public void WriteDataTest_ValidDataAndFile_ReturnsTrue()
        {
            _helperMock.Setup(x => x.FileExists(It.IsAny <string>())).Returns(true);
            _helperMock.Setup(x => x.AppendDataTofile(It.IsAny <string>(), It.IsAny <string>())).Returns(true);

            var obj    = new CSVProcessorRepository(_logger.Object, _helperMock.Object);
            var actual = obj.WriteData("Sample.csv", "1,1,1,2,3");

            Assert.IsTrue(actual);
        }