示例#1
0
        public async Task Given_A_CardId_Should_Return_Rulings()
        {
            // Arrange
            var expected = "Blue-Eyes White Dragon";

            var query = new RulingsByCardIdQuery();

            _rulingService.GetRulingsByCardId(Arg.Any <long>()).Returns(new List <RulingSection>
            {
                new RulingSection
                {
                    CardId = 234242,
                    Name   = "Blue-Eyes White Dragon",
                    Ruling = new List <Ruling>
                    {
                        new Ruling
                        {
                            Text = "Effect Activated during damage calculation"
                        }
                    }
                }
            });

            // Act
            var result = await _sut.Handle(query, CancellationToken.None);

            // Assert
            result.Should().HaveCount(1).And.ContainSingle(r => r.Name.Equals(expected, StringComparison.CurrentCultureIgnoreCase));
        }
示例#2
0
        public async Task Given_A_CardId_Should_Invoke_GetRulingsByCardId_Once()
        {
            // Arrange
            var query = new RulingsByCardIdQuery();

            _rulingService.GetRulingsByCardId(Arg.Any <long>()).Returns(new List <RulingSection>
            {
                new RulingSection
                {
                    CardId = 234242,
                    Name   = "Blue-Eyes White Dragon",
                    Ruling = new List <Ruling>
                    {
                        new Ruling
                        {
                            Text = "Effect Activated during damage calculation"
                        }
                    }
                }
            });

            // Act
            await _sut.Handle(query, CancellationToken.None);

            // Assert
            await _rulingService.Received(1).GetRulingsByCardId(Arg.Any <long>());
        }
示例#3
0
        public async Task Given_A_CardId_If_No_Rulings_Are_Found_Should_Return_Default_Ruling()
        {
            // Arrange
            var expected = "No rulings for this card yet.....";

            var query = new RulingsByCardIdQuery();

            _rulingService.GetRulingsByCardId(Arg.Any <long>()).Returns(new List <RulingSection>());

            // Act
            var result = await _sut.Handle(query, CancellationToken.None);

            // Assert
            result.Should().HaveCount(1).And.ContainSingle(r => r.Name.Equals(expected, StringComparison.CurrentCultureIgnoreCase));
        }