public void ContainsConsiderationTest1()
        {
            var collection    = new ConsiderationCollection();
            var consideration = new BasicConsideration("name", collection);

            Assert.That(collection.Contains("name"));
        }
        public void EnsureSameInstanceConsiderationIsNotAddedTest()
        {
            _considerations.Clear();
            var c  = ConsiderationConstructor.Chebyshev("name", _considerations);
            var b1 = new BasicConsideration("b1", _considerations);

            Assert.That(c.AddConsideration(b1));
            Assert.That(c.AddConsideration(b1) == false);
        }
        public void SameNameIdIsNotAddedTest()
        {
            _considerations.Clear();
            var c  = ConsiderationConstructor.Chebyshev("name", _considerations);
            var b1 = new BasicConsideration("b1", _considerations);

            Assert.That(c.AddConsideration("b1"));
            Assert.That(c.AddConsideration("b1") == false);
        }
        public void ClearTest()
        {
            var collection    = new ConsiderationCollection();
            var consideration = new BasicConsideration("name", collection);

            Assert.That(collection.Contains("name"));
            collection.Clear();
            Assert.That(collection.Contains("name") == false);
        }
        public void ContainsConsiderationTest2()
        {
            var collection    = new ConsiderationCollection();
            var consideration = new BasicConsideration();

            consideration.NameId = "name";
            collection.Add(consideration);
            Assert.That(collection.Contains("name"));
        }
        public void AddConsiderationTest()
        {
            var collection    = new ConsiderationCollection();
            var consideration = new BasicConsideration();

            consideration.NameId = "some";
            Assert.That(collection.Add(consideration));
            Assert.That(collection.Add(consideration) == false);
        }
        public void CloneHasCollectionTest()
        {
            _considerations.Clear();
            var c  = ConsiderationConstructor.Chebyshev("name", _considerations);
            var cc = c.Clone() as ICompositeConsideration;
            var b1 = new BasicConsideration("b1", _considerations);

            Assert.That(c.AddConsideration("b1"));
            Assert.That(cc.AddConsideration("b1"));
        }
Esempio n. 8
0
        public void ConsiderTest(float value, float weight)
        {
            var c = new BasicConsideration();

            _customContext.BaseUtility = new Utility(value, weight);
            c.Consider(_customContext);
            var retUtil = c.Utility;

            Assert.AreEqual(_customContext.BaseUtility, retUtil);
        }
        public void NoDuplicateConsiderationsAllowedTest()
        {
            var collection    = new ConsiderationCollection();
            var consideration = new BasicConsideration("name", collection);

            Assert.That(collection.Contains("name"));
            Assert.Throws <ConsiderationBase.ConsiderationAlreadyExistsInCollectionException>(() => {
                var nc = new BasicConsideration("name", collection);
            });
        }
        public void CreateConsiderationTest()
        {
            var collection    = new ConsiderationCollection();
            var consideration = new BasicConsideration();

            consideration.NameId = "some";
            collection.Add(consideration);
            var newConsideration = collection.Create("some");

            Assert.AreEqual(consideration.NameId, newConsideration.NameId);
            Assert.AreNotEqual(consideration, newConsideration);
        }
        public void EnsureCloneHasConsiderationsTest()
        {
            _considerations.Clear();
            var c  = ConsiderationConstructor.Chebyshev("name", _considerations);
            var b1 = new BasicConsideration("b1", _considerations);
            var b2 = new BasicConsideration("b2", _considerations);

            c.AddConsideration("b1");
            c.AddConsideration("b2");
            var cc = c.Clone() as ICompositeConsideration;

            Assert.That(cc.AddConsideration("b1") == false);
            Assert.That(cc.AddConsideration("b2") == false);
        }
        public void CloneProducesSameUtilityTest([Range(0.0f, 1.0f, 0.1f)] float util)
        {
            _considerations.Clear();
            var           c       = ConsiderationConstructor.WeightedMetrics("name", _considerations, 3.0f);
            CustomContext context = new CustomContext();

            context.BaseUtility = new Utility(util, 0.8f);
            var b1 = new BasicConsideration("b1", _considerations);
            var b2 = new BasicConsideration("b2", _considerations);

            c.AddConsideration("b1");
            c.AddConsideration("b2");
            var cc = c.Clone() as ICompositeConsideration;

            c.Consider(context);
            cc.Consider(context);
            Assert.AreEqual(c.Utility.Value, cc.Utility.Value);
            Assert.AreEqual(c.Utility.Weight, cc.Utility.Weight);
        }
Esempio n. 13
0
        public void ConstructorTest()
        {
            var c = new BasicConsideration();

            Assert.IsNotNull(c);
        }
Esempio n. 14
0
 BasicConsideration(BasicConsideration other) : base(other)
 {
     Initialize();
 }