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

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

            rel.SetValue(5);
            rel.Finalize(12);
            rel.SetValue(8);
        }
示例#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");
        }
示例#4
0
 public void Finalize_AlreadyFinalized()
 {
     Relevance rel = new Relevance();
     rel.SetValue(8);
     rel.Finalize(0.5F);
     rel.Finalize(1);
 }
示例#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);
        }
示例#6
0
        public void Finalize_InvalidFactor()
        {
            Relevance rel = new Relevance();

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

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

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

            rel.SetValue(8);
            rel.Finalize(0.5F);
            Assert.Throws <InvalidOperationException>(() => { rel.Finalize(1); });
        }
示例#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);
        }
示例#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");
 }
示例#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");
        }
示例#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);
        }
示例#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");
        }
示例#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");
 }
示例#16
0
        public void SetValue_InvalidValue()
        {
            Relevance rel = new Relevance();

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

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