public void Lookup_AddedAndNotRemoved_ReturnsTrue(TestType value, Guid tag, long timestamp)
        {
            var ourSet = new OUR_OptimizedSet <TestType>();

            ourSet = ourSet.Add(value, tag, timestamp);

            var lookup = ourSet.Lookup(value);

            Assert.True(lookup);
        }
Example #2
0
        public void Lookup_AddedAndNotRemoved_ReturnsTrue(TestType value, Guid tag, long timestamp)
        {
            var ourSet = new OUR_OptimizedSet <TestType>();

            ourSet = ourSet.Merge(new[] { new OUR_OptimizedSetElement <TestType>(value, tag, timestamp, false) }.ToImmutableHashSet());

            var lookup = ourSet.Lookup(value);

            Assert.True(lookup);
        }
        public void Lookup_SameValueWithSeveralTags_ReturnsTrue(TestType value, Guid tag, long timestamp)
        {
            var ourSet = new OUR_OptimizedSet <TestType>();

            ourSet = ourSet.Add(value, tag, timestamp);
            ourSet = ourSet.Add(value, Guid.NewGuid(), timestamp + 1);
            ourSet = ourSet.Remove(value, tag, timestamp + 2);

            var lookup = ourSet.Lookup(value);

            Assert.True(lookup);
        }
Example #4
0
        public void Lookup_SameValueWithSeveralTags_ReturnsTrue(TestType value, Guid tag, long timestamp)
        {
            var ourSet = new OUR_OptimizedSet <TestType>();

            ourSet = ourSet.Merge(new[] { new OUR_OptimizedSetElement <TestType>(value, tag, timestamp, false) }.ToImmutableHashSet());
            ourSet = ourSet.Merge(new[] { new OUR_OptimizedSetElement <TestType>(value, Guid.NewGuid(), timestamp, false) }.ToImmutableHashSet());

            ourSet = ourSet.Merge(new[] { new OUR_OptimizedSetElement <TestType>(value, tag, timestamp + 2, true) }.ToImmutableHashSet());

            var lookup = ourSet.Lookup(value);

            Assert.True(lookup);
        }
        public void Lookup_AddedRemovedAndUpdated_ReturnsTrue(TestType value, Guid tag, long timestamp)
        {
            var ourSet = new OUR_OptimizedSet <TestType>();

            ourSet = ourSet.Add(value, tag, timestamp);
            ourSet = ourSet.Remove(value, tag, timestamp + 1);

            var newValue = _builder.Build(value.Id);

            ourSet = ourSet.Update(newValue, tag, timestamp + 1);

            var lookup = ourSet.Lookup(newValue);

            Assert.True(lookup);
        }
Example #6
0
        public void Lookup_AddedRemovedAndUpdated_ReturnsTrue(TestType value, Guid tag, long timestamp)
        {
            var ourSet = new OUR_OptimizedSet <TestType>();

            ourSet = ourSet.Merge(new[] { new OUR_OptimizedSetElement <TestType>(value, tag, timestamp, false) }.ToImmutableHashSet());
            ourSet = ourSet.Merge(new[] { new OUR_OptimizedSetElement <TestType>(value, tag, timestamp + 1, true) }.ToImmutableHashSet());

            var newValue = new TestTypeBuilder(new Random()).Build(value.Id);

            ourSet = ourSet.Merge(new[] { new OUR_OptimizedSetElement <TestType>(newValue, tag, timestamp + 3, false) }.ToImmutableHashSet());

            var lookup = ourSet.Lookup(newValue);

            Assert.True(lookup);
        }