Beispiel #1
0
        public void IsCaseSensitive()
        {
            var collection = new PartConstraintCollection();

            collection.Add(ConstraintTest1.Rule);
            Assert.Throws <ArgumentException>(() => collection.Add(ConstraintTest1.Rule));
            collection.Add(ConstraintTest2.Rule);
            Assert.Throws <ArgumentException>(() => collection.Add(ConstraintTest2.Rule));
        }
Beispiel #2
0
        public void ContainsRelationshipTest()
        {
            var collection = new PartConstraintCollection();

            collection.Add(ConstraintTest1.Rule);

            Assert.True(collection.ContainsRelationship(ConstraintTest1.Relationship));
            Assert.False(collection.ContainsRelationship("b"));
        }
Beispiel #3
0
        public void CountTests()
        {
            var collection = new PartConstraintCollection();

            Assert.Equal(0, collection.Count);

            collection.Add(ConstraintTest1.Rule);
            Assert.Equal(1, collection.Count);

            Assert.Throws <ArgumentException>(() => collection.Add(ConstraintTest1.Rule));
            Assert.Equal(1, collection.Count);

            collection.Add(ConstraintTest2.Rule);
            Assert.Equal(2, collection.Count);

            Assert.Throws <ArgumentException>(() => collection.Add(ConstraintTest2.Rule));
            Assert.Equal(2, collection.Count);
        }
Beispiel #4
0
        public void TryGet()
        {
            var collection = new PartConstraintCollection();

            collection.Add(ConstraintTest1.Rule);

            Assert.True(collection.TryGetValue(ConstraintTest1.Relationship, out var rule));
            Assert.Equal(ConstraintTest1.Rule, rule);
            Assert.False(collection.TryGetValue("b", out _));
        }