Skip to content

Instantly share code, notes, and snippets.

@Alexei000
Created April 3, 2018 13:11
Show Gist options
  • Save Alexei000/5fd6154fcaac37247dd0ac781df5c8ed to your computer and use it in GitHub Desktop.
Save Alexei000/5fd6154fcaac37247dd0ac781df5c8ed to your computer and use it in GitHub Desktop.
Environment proxy service mock class
public class EnvironmentProxyServiceMock : IEnvironmentProxyService
{
public List<EnvironmentServiceModel> Environments => EnvironmentInitialData.EnvironmentServiceModels;
public Dictionary<int, EnvironmentServiceModel> EnvironmentsMap => Environments.ToDictionary(item => item.EnvironmentId, item => item);
public EnvironmentServiceModel Get(int environmentId) => EnvironmentsMap.ContainsKey(environmentId) ? EnvironmentsMap[environmentId] : null;
public List<EnvironmentTypeApiModel> EnvironmentTypes => EnvironmentInitialData.EnvironmentTypeModels;
public Dictionary<int, EnvironmentTypeApiModel> EnvironmentTypesMap => EnvironmentTypes.ToDictionary(et => et.EnvironmentTypeId, et => et);
public EnvironmentTypeApiModel GetType(int environmentTypeId) => EnvironmentTypesMap.ContainsKey(environmentTypeId)
? EnvironmentTypesMap[environmentTypeId]
: null;
// some methods omitted for brevity
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment