public async Task Should_add_errors_if_assets_are_required_and_empty()
        {
            var sut = new AssetsField(1, "my-asset", Partitioning.Invariant, new AssetsFieldProperties {
                IsRequired = true
            }, assetTester.Object);

            await sut.ValidateAsync(CreateValue(), false, errors);

            errors.ShouldBeEquivalentTo(
                new[] { "<FIELD> is required" });
        }
        public async Task Should_not_add_error_if_assets_are_valid()
        {
            var assetId = Guid.NewGuid();

            assetTester.Setup(x => x.IsValidAsync(assetId)).Returns(TaskHelper.True);

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

            await sut.ValidateAsync(CreateValue(assetId), false, errors);

            Assert.Empty(errors);
        }
        public async Task Should_add_errors_if_asset_are_not_valid()
        {
            var assetId = Guid.NewGuid();

            assetTester.Setup(x => x.IsValidAsync(assetId)).Returns(TaskHelper.False);

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

            await sut.ValidateAsync(CreateValue(assetId), false, errors);

            errors.ShouldBeEquivalentTo(
                new[] { $"<FIELD> contains invalid asset '{assetId}'" });
        }
        public void Should_clone_object()
        {
            var sut = new AssetsField(1, "my-asset", Partitioning.Invariant, assetTester.Object);

            Assert.NotEqual(sut, sut.Enable());
        }
        public void Should_instantiate_field()
        {
            var sut = new AssetsField(1, "my-asset", Partitioning.Invariant, assetTester.Object);

            Assert.Equal("my-asset", sut.Name);
        }