示例#1
0
        public void UnderstandingTheFormula()
        {
            Dictionary <string, uint> developerToContribution;
            double value;

            // The higher the number the more "fractalized"
            // The more developers the higher the number gets.
            // However: Some (very) small contributions make the number smaller.

            // 0
            developerToContribution = new Dictionary <string, uint> {
                { "A", 100 }
            };
            value = FractalValue.Calculate(developerToContribution);
            Assert.AreEqual(0.0, value);

            // 0.5
            developerToContribution = new Dictionary <string, uint> {
                { "A", 100 }, { "B", 100 }
            };
            value = FractalValue.Calculate(developerToContribution);
            Assert.AreEqual(0.5, value);

            // 0.44
            developerToContribution = new Dictionary <string, uint> {
                { "A", 100 }, { "B", 50 }
            };
            value = FractalValue.Calculate(developerToContribution);
            Assert.AreEqual(0.44, Math.Round(value, 2));

            // 0.67
            developerToContribution = new Dictionary <string, uint> {
                { "A", 100 }, { "B", 100 }, { "C", 100 }
            };
            value = FractalValue.Calculate(developerToContribution);
            Assert.AreEqual(0.67, Math.Round(value, 2));

            // 0.625
            developerToContribution = new Dictionary <string, uint> {
                { "A", 100 }, { "B", 50 }, { "C", 50 }
            };
            value = FractalValue.Calculate(developerToContribution);
            Assert.AreEqual(0.625, Math.Round(value, 3));

            // 0.75
            developerToContribution = new Dictionary <string, uint> {
                { "A", 100 }, { "B", 100 }, { "C", 100 }, { "D", 100 }
            };
            value = FractalValue.Calculate(developerToContribution);
            Assert.AreEqual(0.75, Math.Round(value, 2));

            // 0.057
            developerToContribution = new Dictionary <string, uint> {
                { "A", 100 }, { "B", 1 }, { "C", 1 }, { "D", 1 }
            };
            value = FractalValue.Calculate(developerToContribution);
            Assert.AreEqual(0.057, Math.Round(value, 3));

            // 0.46
            developerToContribution = new Dictionary <string, uint> {
                { "A", 100 }, { "B", 50 }, { "C", 1 }, { "D", 1 }
            };
            value = FractalValue.Calculate(developerToContribution);
            Assert.AreEqual(0.46, Math.Round(value, 2));
        }
示例#2
0
        public void UnderstandingTheFomrula()
        {
            Dictionary <string, uint> developerToContribution;
            double value;

            // The higher the number the more "fractalized"
            // The more developers the higher the number gets.
            // However: Some (very) small contributions make the number smaller.

            // 0
            developerToContribution = new Dictionary <string, uint>();
            developerToContribution.Add("A", 100);
            value = FractalValue.Calculate(developerToContribution);

            // 0.5
            developerToContribution = new Dictionary <string, uint>();
            developerToContribution.Add("A", 100);
            developerToContribution.Add("B", 100);
            value = FractalValue.Calculate(developerToContribution);

            // 0.44
            developerToContribution = new Dictionary <string, uint>();
            developerToContribution.Add("A", 100);
            developerToContribution.Add("B", 50);
            value = FractalValue.Calculate(developerToContribution);

            // 0.67
            developerToContribution = new Dictionary <string, uint>();
            developerToContribution.Add("A", 100);
            developerToContribution.Add("B", 100);
            developerToContribution.Add("C", 100);
            value = FractalValue.Calculate(developerToContribution);

            // 0.625
            developerToContribution = new Dictionary <string, uint>();
            developerToContribution.Add("A", 100);
            developerToContribution.Add("B", 50);
            developerToContribution.Add("C", 50);
            value = FractalValue.Calculate(developerToContribution);

            // 0.75
            developerToContribution = new Dictionary <string, uint>();
            developerToContribution.Add("A", 100);
            developerToContribution.Add("B", 100);
            developerToContribution.Add("C", 100);
            developerToContribution.Add("D", 100);
            value = FractalValue.Calculate(developerToContribution);

            // 0.0057
            developerToContribution = new Dictionary <string, uint>();
            developerToContribution.Add("A", 100);
            developerToContribution.Add("B", 1);
            developerToContribution.Add("C", 1);
            developerToContribution.Add("D", 1);
            value = FractalValue.Calculate(developerToContribution);

            // 0.46
            developerToContribution = new Dictionary <string, uint>();
            developerToContribution.Add("A", 100);
            developerToContribution.Add("B", 50);
            developerToContribution.Add("C", 1);
            developerToContribution.Add("D", 1);
            value = FractalValue.Calculate(developerToContribution);
        }
示例#3
0
 public double CalculateFractalValue()
 {
     return(FractalValue.Calculate(DeveloperToContribution));
 }