1
exercism fetch csharp queen-attack

QueenAttackTest.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
86
87
88
89
90
91
92
93
// This file was auto-generated based on version 2.0.0 of the canonical data.

using Xunit;
using System;

public class QueenAttackTest
{
    [Fact]
    public void Queen_with_a_valid_position_does_not_throw_exception()
    {
        var actual = QueenAttack.Create(2, 2);
    }

    [Fact(Skip = "Remove to run test")]
    public void Queen_must_have_positive_row()
    {
        Assert.Throws<ArgumentOutOfRangeException>(() => QueenAttack.Create(-2, 2));
    }

    [Fact(Skip = "Remove to run test")]
    public void Queen_must_have_row_on_board()
    {
        Assert.Throws<ArgumentOutOfRangeException>(() => QueenAttack.Create(8, 4));
    }

    [Fact(Skip = "Remove to run test")]
    public void Queen_must_have_positive_column()
    {
        Assert.Throws<ArgumentOutOfRangeException>(() => QueenAttack.Create(2, -2));
    }

    [Fact(Skip = "Remove to run test")]
    public void Queen_must_have_column_on_board()
    {
        Assert.Throws<ArgumentOutOfRangeException>(() => QueenAttack.Create(4, 8));
    }

    [Fact(Skip = "Remove to run test")]
    public void Can_not_attack()
    {
        var whiteQueen = QueenAttack.Create(2,4);
        var blackQueen = QueenAttack.Create(6,6);
        Assert.False(QueenAttack.CanAttack(whiteQueen, blackQueen));
    }

    [Fact(Skip = "Remove to run test")]
    public void Can_attack_on_same_row()
    {
        var whiteQueen = QueenAttack.Create(2,4);
        var blackQueen = QueenAttack.Create(2,6);
        Assert.True(QueenAttack.CanAttack(whiteQueen, blackQueen));
    }

    [Fact(Skip = "Remove to run test")]
    public void Can_attack_on_same_column()
    {
        var whiteQueen = QueenAttack.Create(4,5);
        var blackQueen = QueenAttack.Create(2,5);
        Assert.True(QueenAttack.CanAttack(whiteQueen, blackQueen));
    }

    [Fact(Skip = "Remove to run test")]
    public void Can_attack_on_first_diagonal()
    {
        var whiteQueen = QueenAttack.Create(2,2);
        var blackQueen = QueenAttack.Create(0,4);
        Assert.True(QueenAttack.CanAttack(whiteQueen, blackQueen));
    }

    [Fact(Skip = "Remove to run test")]
    public void Can_attack_on_second_diagonal()
    {
        var whiteQueen = QueenAttack.Create(2,2);
        var blackQueen = QueenAttack.Create(3,1);
        Assert.True(QueenAttack.CanAttack(whiteQueen, blackQueen));
    }

    [Fact(Skip = "Remove to run test")]
    public void Can_attack_on_third_diagonal()
    {
        var whiteQueen = QueenAttack.Create(2,2);
        var blackQueen = QueenAttack.Create(1,1);
        Assert.True(QueenAttack.CanAttack(whiteQueen, blackQueen));
    }

    [Fact(Skip = "Remove to run test")]
    public void Can_attack_on_fourth_diagonal()
    {
        var whiteQueen = QueenAttack.Create(2,2);
        var blackQueen = QueenAttack.Create(5,5);
        Assert.True(QueenAttack.CanAttack(whiteQueen, blackQueen));
    }
}