コード例 #1
0
        public async Task Should_add_errors_if_asset_are_not_valid()
        {
            var assetId = Guid.NewGuid();

            var sut = new AssetsField(1, "my-asset", Partitioning.Invariant);

            await sut.ValidateAsync(CreateValue(assetId), errors, ValidationTestExtensions.InvalidContext(assetId));

            errors.ShouldBeEquivalentTo(
                new[] { $"<FIELD> contains invalid asset '{assetId}'." });
        }
コード例 #2
0
        public async Task Should_add_errors_if_reference_are_not_valid()
        {
            var referenceId = Guid.NewGuid();

            var sut = new ReferencesField(1, "my-refs", Partitioning.Invariant, new ReferencesFieldProperties {
                SchemaId = schemaId
            });

            await sut.ValidateAsync(CreateValue(referenceId), errors, ValidationTestExtensions.InvalidContext(referenceId));

            errors.ShouldBeEquivalentTo(
                new[] { $"<FIELD> contains invalid reference '{referenceId}'" });
        }