public void ImplicitConversionFromNullString() { string nullString = null; Nest.AutoExpandReplicas autoExpandReplicas = nullString; autoExpandReplicas.Should().BeNull(); }
public void ImplicitConversionFromMinAndMaxString() { string minAndMax = "0-5"; Nest.AutoExpandReplicas autoExpandReplicas = minAndMax; autoExpandReplicas.Should().NotBeNull(); autoExpandReplicas.Enabled.Should().BeTrue(); autoExpandReplicas.MinReplicas.Should().Be(0); autoExpandReplicas.MaxReplicas.Match(i => i.Should().Be(5), s => Assert.True(false, "expecting a match on integer")); autoExpandReplicas.ToString().Should().Be(minAndMax); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { if (reader.TokenType == JsonToken.Boolean) { return(AutoExpandReplicas.Disabled); } if (reader.TokenType == JsonToken.String) { return(AutoExpandReplicas.Create((string)reader.Value)); } throw new JsonSerializationException($"Cannot deserialize {typeof(AutoExpandReplicas)} from {reader.TokenType}"); }
public void ImplicitConversionFromMinAndAllString() { var minAndMax = "0-all"; Nest.AutoExpandReplicas autoExpandReplicas = minAndMax; autoExpandReplicas.Should().NotBeNull(); autoExpandReplicas.Enabled.Should().BeTrue(); autoExpandReplicas.MinReplicas.Should().Be(0); autoExpandReplicas.MaxReplicas.Match( i => Assert.True(false, "expecting a match on string"), s => s.Should().Be("all")); autoExpandReplicas.ToString().Should().Be(minAndMax); }
/// <inheritdoc/> public TDescriptor AutoExpandReplicas(AutoExpandReplicas autoExpandReplicas) => Assign(a => a.AutoExpandReplicas = autoExpandReplicas);