Skip to content

Commit

Permalink
Adding format handling for the new ExecutionReason.Portal enum value
Browse files Browse the repository at this point in the history
  • Loading branch information
mathewc committed Dec 20, 2015
1 parent c174efa commit 1536a2f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public static string FormatReason(this FunctionStartedMessage message)
return "This function was programmatically called via the host APIs.";
case ExecutionReason.Dashboard:
return message.ParentId.HasValue ? "Replayed from Dashboard." : "Ran from Dashboard.";
case ExecutionReason.Portal:
return message.ParentId.HasValue ? "Replayed from Portal." : "Ran from Portal.";
default:
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using Microsoft.Azure.WebJobs.Host.Protocols;
using Xunit;
Expand Down Expand Up @@ -58,5 +59,17 @@ public void FormatReason_ReasonDetailsAlreadySet_ReturnsExpectedReason()
string result = message.FormatReason();
Assert.Equal("The trigger fired!", result);
}

[Fact]
public void FormatReason_Portal_ReturnsExpectedReason()
{
FunctionStartedMessage message = new FunctionStartedMessage();
message.Reason = ExecutionReason.Portal;

Assert.Equal("Ran from Portal.", message.FormatReason());

message.ParentId = Guid.NewGuid();
Assert.Equal("Replayed from Portal.", message.FormatReason());
}
}
}

0 comments on commit 1536a2f

Please sign in to comment.