forked from tonerdo/dotnet-env
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
1,274 additions
and
542 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("DotNetEnv.Tests")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Collections.Generic; | ||
|
||
namespace DotNetEnv | ||
{ | ||
public interface IValue | ||
{ | ||
string GetValue (); | ||
} | ||
|
||
public class ValueInterpolated : IValue | ||
{ | ||
private readonly string _id; | ||
|
||
public ValueInterpolated (string id) | ||
{ | ||
_id = id; | ||
} | ||
|
||
public string GetValue () | ||
{ | ||
return Environment.GetEnvironmentVariable(_id) ?? string.Empty; | ||
} | ||
} | ||
|
||
public class ValueActual : IValue | ||
{ | ||
private readonly string _value; | ||
|
||
public ValueActual (IEnumerable<string> strs) | ||
{ | ||
_value = string.Join(string.Empty, strs); | ||
} | ||
|
||
public string GetValue () | ||
{ | ||
return _value; | ||
} | ||
} | ||
|
||
public class ValueCalculator | ||
{ | ||
public readonly string Value; | ||
|
||
public ValueCalculator (IEnumerable<IValue> values) | ||
{ | ||
// note that we do want this lookup / calculation / GetValue calls in the ctor | ||
// because it is the state of the world at the moment that this value is calculated | ||
Value = string.Join(string.Empty, values.Select(val => val.GetValue())); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return Value; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.