Skip to content

Commit

Permalink
- Remove dead demo code
Browse files Browse the repository at this point in the history
  • Loading branch information
nwithan8 committed Jun 12, 2024
1 parent 5618a1b commit 9f70457
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 44 deletions.
40 changes: 0 additions & 40 deletions EasyPost/Parameters/BaseParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,45 +278,5 @@ private void Add(RequestParameterAttribute requestParameterAttribute, object? va

return dictionary;
}

/// <summary>
/// Check that all parameters in a list are set.
/// </summary>
/// <param name="parameterNames">List of parameter names to check.</param>
/// <returns>True if all parameters are set, false otherwise.</returns>
private bool AllParametersSet(List<string> parameterNames)
{
return parameterNames.All(parameterName => GetType().GetProperty(parameterName)?.GetValue(this) != null);
}

/// <summary>
/// Check that at least one parameter in a list is set.
/// </summary>
/// <param name="parameterNames">List of parameter names to check.</param>
/// <returns>True if at least one parameter is set, false otherwise.</returns>
private bool AtLeastOneParameterSet(List<string> parameterNames)
{
return parameterNames.Any(parameterName => GetType().GetProperty(parameterName)?.GetValue(this) != null);
}

/// <summary>
/// Check that only one parameter in a list is set.
/// </summary>
/// <param name="parameterNames">List of parameter names to check.</param>
/// <returns>True if only one parameter is set, false otherwise.</returns>
private bool OnlyOneParameterSet(List<string> parameterNames)
{
return parameterNames.Count(parameterName => GetType().GetProperty(parameterName)?.GetValue(this) != null) == 1;
}

/// <summary>
/// Check that no parameters in a list are set.
/// </summary>
/// <param name="parameterNames">List of parameter names to check.</param>
/// <returns>True if no parameters are set, false otherwise.</returns>
private bool NoParametersSet(List<string> parameterNames)
{
return parameterNames.All(parameterName => GetType().GetProperty(parameterName)?.GetValue(this) == null);
}
}
}
1 change: 0 additions & 1 deletion EasyPost/Parameters/Pickup/Create.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using EasyPost.Utilities.Internal.Attributes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ public Tuple<bool, string> DependentsAreCompliant(object obj, object? propertyVa
foreach (string dependentPropertyName in DependentProperties)
{
PropertyInfo? dependentProperty = obj.GetType().GetProperty(dependentPropertyName);
if (dependentProperty == null) // If a listed dependent property is not found, the dependency is not met (and there is likely a bug in the parameter set source code)

// If a listed dependent property is not found, the dependency is not met (and there is likely a bug in the parameter set source code)
if (dependentProperty == null)
{
return new Tuple<bool, string>(false, dependentPropertyName);
}
Expand Down Expand Up @@ -201,7 +203,8 @@ public sealed class TopLevelRequestParameterDependentsAttribute : RequestParamet
/// <param name="independentStatus">The set status of the independent property.</param>
/// <param name="dependentStatus">The set status of the dependent properties.</param>
/// <param name="dependentProperties">The names of the dependent properties.</param>
public TopLevelRequestParameterDependentsAttribute(IndependentStatus independentStatus, DependentStatus dependentStatus, params string[] dependentProperties) : base(independentStatus, dependentStatus, dependentProperties)
public TopLevelRequestParameterDependentsAttribute(IndependentStatus independentStatus, DependentStatus dependentStatus, params string[] dependentProperties)
: base(independentStatus, dependentStatus, dependentProperties)
{
}
}
Expand Down Expand Up @@ -251,7 +254,8 @@ public sealed class NestedRequestParameterDependentsAttribute : RequestParameter
/// <param name="independentStatus">The set status of the independent property.</param>
/// <param name="dependentStatus">The set status of the dependent properties.</param>
/// <param name="dependentProperties">The names of the dependent properties.</param>
public NestedRequestParameterDependentsAttribute(IndependentStatus independentStatus, DependentStatus dependentStatus, params string[] dependentProperties) : base(independentStatus, dependentStatus, dependentProperties)
public NestedRequestParameterDependentsAttribute(IndependentStatus independentStatus, DependentStatus dependentStatus, params string[] dependentProperties)
: base(independentStatus, dependentStatus, dependentProperties)
{
}
}
Expand Down

0 comments on commit 9f70457

Please sign in to comment.