Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stubs for GitHub and AzDO, Execute from Http & GitHub #2

Merged
merged 11 commits into from
Apr 7, 2019
Prev Previous commit
Next Next commit
Lazy initialization
  • Loading branch information
tbarlow12 committed Mar 12, 2019
commit f1b1eabda3fcbef5bcfccac15f28f0cb9ac04788
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public sealed class AzDOBoardService : BoardService
{
AzDOService github;

private static readonly Lazy<AzDOBoardService> lazy = new Lazy<AzDOBoardService>();
private static readonly Lazy<AzDOBoardService> lazy = new Lazy<AzDOBoardService>(() => new AzDOBoardService());

public static AzDOBoardService Instance { get => lazy.Value; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class TrelloBoardService : BoardService
{
TrelloService trello;

private static readonly Lazy<TrelloBoardService> lazy = new Lazy<TrelloBoardService>();
private static readonly Lazy<TrelloBoardService> lazy = new Lazy<TrelloBoardService>(() => new TrelloBoardService());

public static TrelloBoardService Instance { get => lazy.Value; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class TrelloCardService : CardService
{
TrelloService trello;

private static readonly Lazy<TrelloCardService> lazy = new Lazy<TrelloCardService>();
private static readonly Lazy<TrelloCardService> lazy = new Lazy<TrelloCardService>(() => new TrelloCardService());

public static TrelloCardService Instance { get => lazy.Value; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class TrelloLabelService : LabelService
{
TrelloService trello;

private static readonly Lazy<TrelloLabelService> lazy = new Lazy<TrelloLabelService>();
private static readonly Lazy<TrelloLabelService> lazy = new Lazy<TrelloLabelService>(() => new TrelloLabelService());
public static TrelloLabelService Instance { get => lazy.Value; }

private TrelloLabelService()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class TrelloListService : ListService
{
TrelloService trello;

private static readonly Lazy<TrelloListService> lazy = new Lazy<TrelloListService>();
private static readonly Lazy<TrelloListService> lazy = new Lazy<TrelloListService>(() => new TrelloListService());

public static TrelloListService Instance { get => lazy.Value; }

Expand Down
2 changes: 1 addition & 1 deletion TaskBoardAssistant/Adapters/Trello/TrelloServiceFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace TaskBoardAssistant.Adapters.Trello
{
public class TrelloServiceFactory : ITaskBoardFactory
{
private static readonly Lazy<TrelloServiceFactory> lazy = new Lazy<TrelloServiceFactory>();
private static readonly Lazy<TrelloServiceFactory> lazy = new Lazy<TrelloServiceFactory>(() => new TrelloServiceFactory());
public static TrelloServiceFactory Instance { get => lazy.Value; }
private TrelloServiceFactory()
{
Expand Down
20 changes: 20 additions & 0 deletions TaskBoardAssistant/Assistant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,26 @@ public static IEnumerable<PolicyResult> ExecuteFromBlob(string connectionString,
return Execute(policies);
}

public static IEnumerable<PolicyResult> ExecuteFromYmlString(string policies)
{
return Execute(PolicyService.YmlFromString(policies));
}

public static IEnumerable<PolicyResult> ExecuteFromJsonString(string policies)
{
return Execute(PolicyService.JsonFromString(policies));
}

public static IEnumerable<PolicyResult> ExecuteFromYmlPath(string path)
{
return Execute(PolicyService.YmlFromFile(path));
}

public static IEnumerable<PolicyResult> ExecuteFromJsonPath(string path)
{
return Execute(PolicyService.JsonFromFile(path));
}

private static IEnumerable<PolicyResult> Execute(PolicyCollection collection)
{
ServiceFactory serviceFactory = new ServiceFactory();
Expand Down
1 change: 1 addition & 0 deletions TaskBoardAssistant/TaskBoardAssistant.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Authors>Tanner Barlow</Authors>
<Version>1.0.0</Version>
<Description>Create and execute policies to automate the management of your task board</Description>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion UnitTests/TestListService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ public void TestFactory()
Assert.IsNotNull(listService);
}
}

}