public async Task When_GetFileType_Returns_Unknown_UnmanagedTransactionOutcome_Is_Signaled() { // Arrange RebuildOutcome actualOutcome = null; string actualBlobName = string.Empty; var expectedOutcome = new RebuildOutcome { Outcome = ProcessingOutcome.Unmanaged, RebuiltFileSas = string.Empty }; _mockContext.Setup(s => s.CallActivityAsync <string>( It.Is <string>(s => s == "FileProcessing_GetFileType"), It.IsAny <object>())) .ReturnsAsync("unknown"); _mockContext.Setup(s => s.CallActivityAsync <object>( It.Is <string>(s => s == "FileProcessing_SignalTransactionOutcome"), It.IsAny <object>())) .Callback <string, object>((s, obj) => { actualBlobName = (string)obj.GetType().GetField("Item1").GetValue(obj); actualOutcome = (RebuildOutcome)obj.GetType().GetField("Item2").GetValue(obj); }); // Act await _fileProcessingOrchestrator.RunOrchestrator(_mockContext.Object, _cloudBlobContainer, _mockLogger.Object); // Assert Assert.That(actualBlobName, Is.EqualTo(BlobName)); Assert.That(actualOutcome.Outcome, Is.EqualTo(expectedOutcome.Outcome)); Assert.That(actualOutcome.RebuiltFileSas, Is.EqualTo(expectedOutcome.RebuiltFileSas)); }
public void Setup() { _mockQueueClient = new Mock <IMessageClient <Message> >(); _mockContext = new Mock <IDurableActivityContext>(); _mockLogger = new Mock <ILogger>(); _rebuildOutcome = new RebuildOutcome { Outcome = ProcessingOutcome.Rebuilt, RebuiltFileSas = ExpectedRebuiltFileSas }; _mockContext.Setup(s => s.GetInput <(string, RebuildOutcome)>()).Returns((ExpectedFileId, _rebuildOutcome)); _signalTransactionOutcome = new SignalTransactionOutcome(_mockQueueClient.Object); }