示例#1
0
        public void CumulativeDistribution_GetCumulativeDistribution_WithWeightedValues_ReturnsDistributedValues()
        {
            var weightedValues = new Dictionary <int, double>
            {
                { 1, 2.5 },
                { 45, 0.17 },
                { 100, 43.12 }
            };
            IDictionary <double, int> result = CumulativeDistribution.GetCumulativeDistribution <int>(weightedValues);

            Assert.That(result, Is.EquivalentTo(new Dictionary <double, int>
            {
                { 2.5, 1 },
                { 2.67, 45 },
                { 45.79, 100 }
            }));
        }
示例#2
0
        public void CumulativeDistribution_GetCumulativeDistribution_WithEmptyArgument_ReturnsEmptyResult()
        {
            IDictionary <double, int> result = CumulativeDistribution.GetCumulativeDistribution <int>(new Dictionary <int, double>());

            Assert.That(result, Is.Empty);
        }
示例#3
0
 public void CumulativeDistribution_GetCumulativeDistribution_WithNullArgument_ThrowsArgumentNullException()
 {
     Assert.That(() => CumulativeDistribution.GetCumulativeDistribution <int>(null), Throws.ArgumentNullException);
 }