Added unit tests for both parser and fuzzer

This commit is contained in:
Jan Stárek
2019-10-28 12:01:50 +01:00
parent 5d04195776
commit 01c9afaaca
3 changed files with 115 additions and 0 deletions

View File

@@ -19,6 +19,34 @@ namespace Parser.Tests
Assert.IsNull(parsedAttribute);
}
[Test]
public void ParsingPathAttributeWithPathLocation()
{
OpenApiParameter parameter = new OpenApiParameter
{
Schema = new OpenApiSchema { Type = "string", Format = null },
In = ParameterLocation.Path
};
var parsedAttribute = AttributeParser.ParseAttribute(parameter);
Assert.AreEqual("Path", parsedAttribute.Location);
}
[Test]
public void ParsingPathAttributeWithQueryLocation()
{
OpenApiParameter parameter = new OpenApiParameter
{
Schema = new OpenApiSchema { Type = "string", Format = null },
In = ParameterLocation.Query
};
var parsedAttribute = AttributeParser.ParseAttribute(parameter);
Assert.AreEqual("Query", parsedAttribute.Location);
}
[Test]
public void ParsingAttributeWithNoTypeOrFormatShouldReturnNull()
{