Example #1
0
        public void SetValue_AfterFinalize()
        {
            Relevance rel = new Relevance();

            rel.SetValue(5);
            rel.Finalize(12);
            Assert.Throws <InvalidOperationException>(() => { rel.SetValue(8); });
        }
Example #2
0
        public void SetValue_AfterFinalize()
        {
            Relevance rel = new Relevance();

            rel.SetValue(5);
            rel.Finalize(12);
            rel.SetValue(8);
        }
Example #3
0
        public void SetValue()
        {
            Relevance rel = new Relevance();

            rel.SetValue(8);
            Assert.AreEqual(8, rel.Value, "Wrong value");
            Assert.IsFalse(rel.IsFinalized, "Value should not be finalized");
            rel.SetValue(14);
            Assert.AreEqual(14, rel.Value, "Wrong value");
            Assert.IsFalse(rel.IsFinalized, "Value should not be finalized");
        }
Example #4
0
 public void Finalize_AlreadyFinalized()
 {
     Relevance rel = new Relevance();
     rel.SetValue(8);
     rel.Finalize(0.5F);
     rel.Finalize(1);
 }
Example #5
0
        public void SetValue_Value_Invalid()
        {
            Relevance sut = new Relevance();
            var       ex  = Assert.Throws <ArgumentOutOfRangeException>(() => sut.SetValue(-1));

            Assert.Equal("Value must be greater than or equal to zero.\r\nParameter name: value", ex.Message);
        }
Example #6
0
        public void Finalize_InvalidFactor()
        {
            Relevance rel = new Relevance();

            rel.SetValue(8);
            Assert.Throws <ArgumentOutOfRangeException>(() => { rel.Finalize(-1); });
        }
Example #7
0
        public void Finalize_InvalidFactor()
        {
            Relevance rel = new Relevance();

            rel.SetValue(8);
            rel.Finalize(-1);
        }
Example #8
0
        public void Finalize_AlreadyFinalized()
        {
            Relevance rel = new Relevance();

            rel.SetValue(8);
            rel.Finalize(0.5F);
            rel.Finalize(1);
        }
Example #9
0
        public void Finalize_AlreadyFinalized()
        {
            Relevance rel = new Relevance();

            rel.SetValue(8);
            rel.Finalize(0.5F);
            Assert.Throws <InvalidOperationException>(() => { rel.Finalize(1); });
        }
Example #10
0
        public void Finalize_Factor_Invalid()
        {
            Relevance sut = new Relevance();

            sut.SetValue(0);
            var ex = Assert.Throws <ArgumentOutOfRangeException>(() => sut.Finalize(-1));

            Assert.Equal("Total must be greater than or equal to zero.\r\nParameter name: total", ex.Message);
        }
Example #11
0
 public void Finalize_()
 {
     Relevance rel = new Relevance();
     rel.SetValue(12);
     Assert.AreEqual(12, rel.Value, "Wrong value");
     rel.Finalize(24);
     Assert.AreEqual(50, rel.Value, "Wrong finalized value");
     Assert.IsTrue(rel.IsFinalized, "Value should be finalized");
 }
Example #12
0
        // Underscore to avoid interference with Destructor
        public void Finalize_()
        {
            Relevance rel = new Relevance();

            rel.SetValue(12);
            Assert.AreEqual(12, rel.Value, "Wrong value");
            rel.Finalize(24);
            Assert.AreEqual(50, rel.Value, "Wrong finalized value");
            Assert.IsTrue(rel.IsFinalized, "Value should be finalized");
        }
Example #13
0
        public void Finalize_Already_Performed()
        {
            Relevance sut = new Relevance();

            sut.SetValue(0);
            sut.Finalize(0.5F);
            var ex = Assert.Throws <InvalidOperationException>(() => sut.Finalize(1));

            Assert.Equal("Finalization already performed.", ex.Message);
        }
Example #14
0
        // Underscore to avoid interference with Destructor
        public void Finalize_()
        {
            Relevance rel = new Relevance();

            rel.SetValue(12);
            Assert.Equal(12, rel.Value);
            rel.Finalize(24);
            Assert.Equal(50, rel.Value);
            Assert.True(rel.IsFinalized, "Value should be finalized");
        }
Example #15
0
 public void SetValue()
 {
     Relevance rel = new Relevance();
     rel.SetValue(8);
     Assert.AreEqual(8, rel.Value, "Wrong value");
     Assert.IsFalse(rel.IsFinalized, "Value should not be finalized");
     rel.SetValue(14);
     Assert.AreEqual(14, rel.Value, "Wrong value");
     Assert.IsFalse(rel.IsFinalized, "Value should not be finalized");
 }
Example #16
0
        public void SetValue_InvalidValue()
        {
            Relevance rel = new Relevance();

            rel.SetValue(-1);
        }
Example #17
0
 public void SetValue_InvalidValue()
 {
     Relevance rel = new Relevance();
     rel.SetValue(-1);
 }
Example #18
0
 public void SetValue_AfterFinalize()
 {
     Relevance rel = new Relevance();
     rel.SetValue(5);
     rel.Finalize(12);
     rel.SetValue(8);
 }
Example #19
0
        public void SetValue_InvalidValue()
        {
            Relevance rel = new Relevance();

            Assert.Throws <ArgumentOutOfRangeException>(() => { rel.SetValue(-1); });
        }
Example #20
0
 public void Finalize_InvalidFactor()
 {
     Relevance rel = new Relevance();
     rel.SetValue(8);
     rel.Finalize(-1);
 }