Example #1
0
        public void Should_return_null_from_references_field_when_removing_references_from_null_array()
        {
            var sut = new ReferencesField(1, "my-refs", Partitioning.Invariant);

            var result = sut.CleanReferences(null, null);

            Assert.Null(result);
        }
Example #2
0
        public void Should_return_same_token_from_references_field_when_removing_references_and_nothing_to_remove()
        {
            var id1 = Guid.NewGuid();
            var id2 = Guid.NewGuid();

            var sut = new ReferencesField(1, "my-refs", Partitioning.Invariant);

            var token  = CreateValue(id1, id2);
            var result = sut.CleanReferences(token, new HashSet <Guid>(new[] { Guid.NewGuid() }));

            Assert.Same(token, result);
        }
Example #3
0
        public void Should_remove_all_references_from_references_field_when_schema_is_removed()
        {
            var id1 = Guid.NewGuid();
            var id2 = Guid.NewGuid();

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

            var result = sut.CleanReferences(CreateValue(id1, id2), new HashSet <Guid>(new[] { schemaId }));

            Assert.Equal(CreateValue(), result);
        }