public void FileProcessorService_StartProcess_CreatesMeta_CallOnce() { _reader.Setup(p => p.ReadFile(It.IsAny <string>())).Returns(getJsonContent()); _reader.Setup(p => p.GetMetaData(It.IsAny <JsonObject>())).Returns((JsonObject)JsonObject.Parse(@"{""test"":""test""}")); var objectUnderTest = new FileProcessorService(_loggerMock.Object, _reader.Object, _messageManager.Object, _kafkaPublisher.Object); objectUnderTest.StartProcess(getFileContent(_testFilePath)); _reader.Verify(bar => bar.GetMetaData(It.IsAny <JsonObject>()), Times.Once()); }
public void FileProcessorService_StartProcess_CreatedfileKey() { _reader.Setup(p => p.ReadFile(It.IsAny <string>())).Returns(getJsonContent()); var objectUnderTest = new FileProcessorService(_loggerMock.Object, _reader.Object, _messageManager.Object, _kafkaPublisher.Object); var fileKey = objectUnderTest.StartProcess(getFileContent(_testFilePath)); //verify that StartProcess called FileKeyGenerator() _reader.Verify(bar => bar.FileKeyGenerator(), Times.Once()); }
public void FileProcessorService_DeserializesFile() { string someJson = getFileContent(_testFilePath); var objJsonContent = (JsonObject)JsonObject.Parse(someJson); _reader.Setup(p => p.GetMetaData(It.IsAny <JsonObject>())); //.Returns(getJsonContent()); var objectUnderTest = new FileProcessorService(_loggerMock.Object, _reader.Object, _messageManager.Object, _kafkaPublisher.Object); var fileContents = objectUnderTest.StartProcess(someJson); _reader.Verify(bar => bar.GetMetaData(It.IsAny <JsonObject>()), Times.Once()); }
public void FileProcessorService_StartProcess_SendCompensationInvestments() { _reader.Setup(p => p.ReadFile(It.IsAny <string>())).Returns(getJsonContent()); _reader.Setup(p => p.GetMetaData(It.IsAny <JsonObject>())).Returns(TestHelper.getFileInfo()); _reader.Setup(p => p.GetFileRules(It.IsAny <JsonObject>())).Returns(TestHelper.getCompensationRules()); _reader.Setup(p => p.GetParticipants(It.IsAny <JsonObject>())).Returns(TestHelper.GetParticipants()); _reader.Setup(p => p.CreateCompensationInvestments(It.IsAny <JsonObject>(), It.IsAny <JsonArray>(), It.IsAny <JsonArray>(), It.IsAny <Guid>())).Returns(TestHelper.GenerateCompensationInvestments()); _kafkaPublisher.Setup(p => p.SendParticipantMessages(It.IsAny <List <CompensationInvestment> >())); var objectUnderTest = new FileProcessorService(_loggerMock.Object, _reader.Object, _messageManager.Object, _kafkaPublisher.Object); objectUnderTest.StartProcess(getFileContent(_testFilePath)); _kafkaPublisher.Verify(bar => bar.SendParticipantMessages(It.IsAny <List <CompensationInvestment> >()), Times.Once()); }
public void FileProcessorService_CompensationExists() { _reader.Setup(p => p.ReadFile(It.IsAny <string>())).Returns(getJsonContent()); var objectUnderTest = new FileProcessorService(_loggerMock.Object, _reader.Object, _messageManager.Object, _kafkaPublisher.Object); var fileContents = objectUnderTest.StartProcess(getFileContent(_testFilePath)); }