Esempio n. 1
0
        public void test_add_ratio()
        {
            var dist = new Distance();

            dist.AddRatio("ratio", 25, 100);
            dist.Penalties.Should().BeEquivalentTo(new Dictionary <string, List <double> > {
                { "ratio", new List <double> {
                      0.25
                  } }
            });

            dist.AddRatio("ratio", 10, 5);
            dist.Penalties.Should().BeEquivalentTo(new Dictionary <string, List <double> > {
                { "ratio", new List <double> {
                      0.25, 1.0
                  } }
            });

            dist.AddRatio("ratio", -5, 5);
            dist.Penalties.Should().BeEquivalentTo(new Dictionary <string, List <double> > {
                { "ratio", new List <double> {
                      0.25, 1.0, 0.0
                  } }
            });

            dist.AddRatio("ratio", 5, 0);
            dist.Penalties.Should().BeEquivalentTo(new Dictionary <string, List <double> > {
                { "ratio", new List <double> {
                      0.25, 1.0, 0.0, 0.0
                  } }
            });
        }