public void GetDataTest_ExpectedException() { IEnumerable <SaleRecord> expected = null; _cSVProcessorRepositoryMock.Setup(x => x.GetData(It.IsAny <string>())).Returns(expected); var serviceObj = new CSVProcessorService(_cSVProcessorRepositoryMock.Object, _logger.Object); var actual = serviceObj.GetData("Test"); }
public void WriteDataTest_InValidData_ReturnsFailure() { var expected = false; _cSVProcessorRepositoryMock.Setup(x => x.WriteData(It.IsAny <string>(), It.IsAny <string>())).Returns(expected); var serviceObj = new CSVProcessorService(_cSVProcessorRepositoryMock.Object, _logger.Object); var actual = serviceObj.WriteData("Test", "asdasd"); Assert.AreEqual(expected, actual); }
public void WriteDataTest_ValidData_ReturnsSuccess() { var expected = true; _cSVProcessorRepositoryMock.Setup(x => x.WriteData(It.IsAny <string>(), It.IsAny <string>())).Returns(expected); var serviceObj = new CSVProcessorService(_cSVProcessorRepositoryMock.Object, _logger.Object); var actual = serviceObj.WriteData("Test", "1,1,1,2,3,54"); Assert.AreEqual(expected, actual); }
public void GetDataTest_ReturnsValidData() { var expected = new List <SaleRecord> { { new SaleRecord { Country = "Australia", OrderID = 1, TotalCost = 100.00, UnitsSold = 1 } } }; _cSVProcessorRepositoryMock.Setup(x => x.GetData(It.IsAny <string>())).Returns(expected); var serviceObj = new CSVProcessorService(_cSVProcessorRepositoryMock.Object, _logger.Object); var actual = serviceObj.GetData("Test"); Assert.AreEqual(expected, actual); }