1
exercism fetch csharp perfect-numbers

PerfectNumbersTest.cs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// This file was auto-generated based on version 1.0.1 of the canonical data.

using Xunit;
using System;

public class PerfectNumbersTest
{
    [Fact]
    public void Smallest_perfect_number_is_classified_correctly()
    {
        Assert.Equal(Classification.Perfect, PerfectNumbers.Classify(6));
    }

    [Fact(Skip = "Remove to run test")]
    public void Medium_perfect_number_is_classified_correctly()
    {
        Assert.Equal(Classification.Perfect, PerfectNumbers.Classify(28));
    }

    [Fact(Skip = "Remove to run test")]
    public void Large_perfect_number_is_classified_correctly()
    {
        Assert.Equal(Classification.Perfect, PerfectNumbers.Classify(33550336));
    }

    [Fact(Skip = "Remove to run test")]
    public void Smallest_abundant_number_is_classified_correctly()
    {
        Assert.Equal(Classification.Abundant, PerfectNumbers.Classify(12));
    }

    [Fact(Skip = "Remove to run test")]
    public void Medium_abundant_number_is_classified_correctly()
    {
        Assert.Equal(Classification.Abundant, PerfectNumbers.Classify(30));
    }

    [Fact(Skip = "Remove to run test")]
    public void Large_abundant_number_is_classified_correctly()
    {
        Assert.Equal(Classification.Abundant, PerfectNumbers.Classify(33550335));
    }

    [Fact(Skip = "Remove to run test")]
    public void Smallest_prime_deficient_number_is_classified_correctly()
    {
        Assert.Equal(Classification.Deficient, PerfectNumbers.Classify(2));
    }

    [Fact(Skip = "Remove to run test")]
    public void Smallest_non_prime_deficient_number_is_classified_correctly()
    {
        Assert.Equal(Classification.Deficient, PerfectNumbers.Classify(4));
    }

    [Fact(Skip = "Remove to run test")]
    public void Medium_deficient_number_is_classified_correctly()
    {
        Assert.Equal(Classification.Deficient, PerfectNumbers.Classify(32));
    }

    [Fact(Skip = "Remove to run test")]
    public void Large_deficient_number_is_classified_correctly()
    {
        Assert.Equal(Classification.Deficient, PerfectNumbers.Classify(33550337));
    }

    [Fact(Skip = "Remove to run test")]
    public void Edge_case_no_factors_other_than_itself_is_classified_correctly()
    {
        Assert.Equal(Classification.Deficient, PerfectNumbers.Classify(1));
    }

    [Fact(Skip = "Remove to run test")]
    public void Zero_is_rejected_not_a_natural_number_()
    {
        Assert.Throws<ArgumentOutOfRangeException>(() => PerfectNumbers.Classify(0));
    }

    [Fact(Skip = "Remove to run test")]
    public void Negative_integer_is_rejected_not_a_natural_number_()
    {
        Assert.Throws<ArgumentOutOfRangeException>(() => PerfectNumbers.Classify(-1));
    }
}