示例#1
0
        public void Parse_GetCardTypeReturnsCardType_CallsGetFunctionForCardType(Type cardType, bool isGetFeatCalled, bool isGetSkillCalled)
        {
            // Arrange
            var parser = new ParserMock(cardType);

            // Act
            parser.Parse("Valid response");

            // Assert
            Assert.AreEqual(isGetFeatCalled, parser.IsGetFeatCalled);
            Assert.AreEqual(isGetSkillCalled, parser.IsGetSkillCalled);
        }
示例#2
0
        public void Parse_ValidResponseIsPassedToParse_GetCardTypeAndGetFunctionForCardTypeAreCalledWithSameResponse(Type cardType, string response, string featResponse, string skillResponse)
        {
            // Arrange
            var parser = new ParserMock(cardType);

            // Act
            parser.Parse(response);

            // Assert
            Assert.AreEqual(featResponse, parser.ResponsePassedToGetFeat);
            Assert.AreEqual(skillResponse, parser.ResponsePassedToGetSkill);
            Assert.AreEqual(response, parser.ResponsePassedToGetCardType);
        }
示例#3
0
        public void ParseToleratesExtraTokens(string signature)
        {
            var parser = new ParserMock();

            Assert.That(() => parser.Parse(signature), Throws.Nothing);
        }
示例#4
0
        public void ParseToleratesTrailingDelimiters(string signature)
        {
            var parser = new ParserMock();

            Assert.That(() => parser.Parse(signature), Throws.Nothing);
        }
示例#5
0
        public void ParseSignatureFailsWhenExpirationIsInvalid(string signature)
        {
            var parser = new ParserMock();

            Assert.That(() => parser.Parse(signature), Throws.ArgumentException);
        }
示例#6
0
        public void ParseSignatureFailsWhenValuesAreMissing(string signature)
        {
            var parser = new ParserMock();

            Assert.That(() => parser.Parse(signature), Throws.ArgumentException);
        }