public IEnumerable <IValuable> Build(ValuableType type, IEnumerable <string> items) { foreach (var item in items) { yield return(Build(type, item)); } }
public IEnumerable<IValuable> Build(ValuableType type, IEnumerable<string> items) { foreach (var item in items) { yield return Build(type, item); } }
public ThrowableValuable( ValuableType valuableType, [JsonProperty(nameof(PresentValue))] double?karmaValue = default ) { ValuableType = valuableType; PresentValue = karmaValue.GetValueOrDefault(valuableType.FaceValue()); }
public IValuable Build(ValuableType type, string item) { switch (type) { case ValuableType.Value: return new Value(item); case ValuableType.Column: return new Column(item); default: throw new ArgumentException(); } }
public IValuable Build(ValuableType type, string item) { switch (type) { case ValuableType.Value: return(new Value(item)); case ValuableType.Column: return(new Column(item)); default: throw new ArgumentException(); } }
public void TestFirstValuableEnabledOnNewSave() { const string nickName = nameof(TestFirstValuableEnabledOnNewSave); var fortuneFountainSaveData = FortuneFountainSaveData.NewSaveFile(nickName); const ValuableType expectedFirstValuableType = 0; Assert.That(fortuneFountainSaveData.PlayerValuables, Has.Some.Property(nameof(PlayerValuable.ValuableType)).EqualTo(expectedFirstValuableType), $"The new save file didn't contain PlayerValuable type 0 ({expectedFirstValuableType})!"); Assert.That(fortuneFountainSaveData.PlayerValuables.Count, Is.EqualTo(1), "The save file contained extra player valuables!"); }
/// <summary> /// Constructs a new <see cref="ValuableModel"/>. /// /// Should <b>only</b> be called when the <see cref="ValuableDatabase"/> is initialized. /// /// Should use explicit parameter names whenever possible. /// </summary> /// <param name="type"><see cref="Type"/></param> /// <param name="immutableValue"><see cref="ImmutableValue"/></param> /// <param name="denominations"><see cref="Denominations"/></param> /// <param name="displayName"><see cref="DisplayName"/>. Defaults to <paramref name="type"/>.</param> /// <exception cref="ArgumentException">if <paramref name="denominations"/> is empty.</exception> /// <exception cref="ArgumentNullException">if <paramref name="denominations"/> or any of its items are null.</exception> public ValuableModel( ValuableType type, Plurable displayName, long immutableValue, [NotNull] params Plurable[] denominations ) { if (denominations.Length == 0) { throw new ArgumentException("Value cannot be an empty collection.", nameof(denominations)); } Type = type; DisplayName = displayName; ImmutableValue = immutableValue; Denominations = denominations ?? throw new ArgumentNullException(nameof(denominations)); }
public static double FaceValue(this ValuableType valuableType) { return(ValuableDatabase.Models[valuableType].ImmutableValue); }