public static async Task AssertSchemaMustNotExist(this ISquidexAppSchemaClient that, string application, string name, TimeSpan?delay = null) { // because of eventual consistency if (delay.HasValue) { await Task.Delay(delay.Value); } var exists = await that.SchemaExists(application, name); exists.Should().BeFalse(); }
public static async Task <bool> SchemaExists(this ISquidexAppSchemaClient that, string application, string name = null) { var data = await that.GetAllSchemas(application); var count = Convert.ToInt32(data.Count); if (string.IsNullOrEmpty(name) || string.IsNullOrWhiteSpace(name)) { return(count > 0); } var any = ((IEnumerable <dynamic>)data).Any(d => CheckEquality(d, name)); return(count != 0 && any); }