public void RemovingNonExistentFeature()
        {
            IContextFeature contextFeature = new ValueContextFeature <string>("Type 1", "Entry 1");

            _socialContext.RemoveContextFeatures(contextFeature);
            Assert.Empty(_socialContext.ContextFeatures);
        }
        public void AddingSameFeatureTwice()
        {
            IContextFeature contextFeature = new ValueContextFeature <string>("Type 1", "Entry 1");

            _socialContext.AddContextFeatures(contextFeature);
            _socialContext.AddContextFeatures(contextFeature);
            Assert.Single(_socialContext.ContextFeatures);
        }
예제 #3
0
        public override bool Equals(object obj)
        {
            if (!(obj is ValueContextFeature <T>))
            {
                return(false);
            }
            ValueContextFeature <T> valueObj = (ValueContextFeature <T>)obj;

            return(valueObj.Type.Equals(Type) && valueObj.Value.Equals(Value));
        }
        public void AddingAndRemovingDistinctFeatures()
        {
            IContextFeature contextFeature1 = new ValueContextFeature <string>("Type 1", "Entry 1");
            IContextFeature contextFeature2 = new ValueContextFeature <string>("Type 1", "Entry 2");

            _socialContext.AddContextFeatures(contextFeature1);
            _socialContext.AddContextFeatures(contextFeature2);
            _socialContext.RemoveContextFeatures(contextFeature1);
            Assert.Single(_socialContext.ContextFeatures);
        }
        public void RemovingClonedFeature()
        {
            IContextFeature contextFeature      = new ValueContextFeature <string>("Type 1", "Entry 1");
            IContextFeature contextFeatureClone = new ValueContextFeature <string>("Type 1", "Entry 1");

            _socialContext.AddContextFeatures(contextFeature);
            _socialContext.AddContextFeatures(contextFeatureClone);
            _socialContext.RemoveContextFeatures(contextFeatureClone);
            Assert.Empty(_socialContext.ContextFeatures);
        }
예제 #6
0
 public ValueContextFeatureEqualityTests()
 {
     _stringFeature1      = new ValueContextFeature <string>("Type1", "1");
     _stringFeature1Clone = new ValueContextFeature <string>("Type1", "1");
     _stringFeature2      = new ValueContextFeature <string>("Type1", "2");
     _stringFeature3      = new ValueContextFeature <string>("Type2", "1");
     _intFeature1         = new ValueContextFeature <int>("Type1", 1);
     _intFeature1Clone    = new ValueContextFeature <int>("Type1", 1);
     _intFeature2         = new ValueContextFeature <int>("Type1", 2);
     _intFeature3         = new ValueContextFeature <int>("Type2", 1);
 }
 public ValueContextFeatureConstructionTests()
 {
     _stringFeature = new ValueContextFeature <string>("Type string", "1");
     _intFeature    = new ValueContextFeature <int>("Type int", 1);
 }