public Task CanCreate_should_throw_exception_if_fields_contain_duplicate_names() { var command = new CreateSchema { AppId = appId, Fields = new List <CreateSchemaField> { new CreateSchemaField { Name = "field1", Properties = ValidProperties(), Partitioning = "invariant" }, new CreateSchemaField { Name = "field1", Properties = ValidProperties(), Partitioning = "invariant" } }, Name = "new-schema" }; return(Assert.ThrowsAsync <ValidationException>(() => GuardSchema.CanCreate(command, appProvider))); }
public Task CanCreate_should_throw_exception_if_fields_not_valid() { var command = new CreateSchema { AppId = appId, Fields = new List <CreateSchemaField> { new CreateSchemaField { Name = null, Properties = null, Partitioning = "invalid", }, new CreateSchemaField { Name = null, Properties = InvalidProperties(), Partitioning = "invalid", } }, Name = "new-schema" }; return(Assert.ThrowsAsync <ValidationException>(() => GuardSchema.CanCreate(command, schemas))); }
public Task CanCreate_should_throw_exception_if_name_not_valid() { var command = new CreateSchema { AppId = appId, Name = "INVALID NAME" }; return(Assert.ThrowsAsync <ValidationException>(() => GuardSchema.CanCreate(command, appProvider))); }
public Task CanCreate_should_not_throw_exception_if_command_is_valid() { var command = new CreateSchema { AppId = appId, Name = "new-schema" }; return(GuardSchema.CanCreate(command, appProvider)); }
public Task CanCreate_should_throw_exception_if_name_already_in_use() { A.CallTo(() => appProvider.GetSchemaAsync(A <string> .Ignored, "new-schema", false)) .Returns(Task.FromResult(A.Fake <ISchemaEntity>())); var command = new CreateSchema { AppId = appId, Name = "new-schema" }; return(Assert.ThrowsAsync <ValidationException>(() => GuardSchema.CanCreate(command, appProvider))); }
public Task CanCreate_should_throw_exception_if_name_already_in_use() { A.CallTo(() => schemas.FindSchemaByNameAsync(A <Guid> .Ignored, "new-schema")) .Returns(Task.FromResult(A.Fake <ISchemaEntity>())); var command = new CreateSchema { AppId = appId, Name = "new-schema" }; return(Assert.ThrowsAsync <ValidationException>(() => GuardSchema.CanCreate(command, schemas))); }