Skip to content

Commit

Permalink
add corner cases
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-nikonov committed Sep 5, 2024
1 parent 5a3ff8d commit 93ab9c3
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions clio.tests/ApplicationPackageListProviderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,27 @@ public void CreatePackageInfo_ThrowExceprionIfResponseIsIncorect(string response
}

[TestCase("[]", 0)]
[TestCase("[{\"Name\":\"X\"}]", 1)]
[TestCase("[{\"Name\":\"X\", \"Maintainer\":\"Y\" }]", 1)]
[TestCase("[{\"Name\":\"X\", \"Maintainer\":\"Y\" },{\"Name\":\"X\", \"Maintainer\":\"Y\" }]", 2)]
[TestCase("[{\"Name\":\"X\", \"Maintainer\":\"Y\" },{\"Name\":\"X\", \"Maintainer\":\"Y\" },{\"Name\":\"X\", \"Maintainer\":\"Y\" }]", 3)]
[TestCase("[{\"Name\":\"X\", \"Maintainer\":\"Y\", \"UId\":\"00000000-0000-0000-0000-000000000001\", \"Version\":\"1.0.0\" }]", 1)]
[TestCase("[{\"Name\":\"X\", \"Maintainer\":\"Y\", \"UId\":\"00000000-0000-0000-0000-000000000001\", \"Version\":\"1.0.0\" },{\"Name\":\"X\", \"Maintainer\":\"Y\", \"UId\":\"00000000-0000-0000-0000-000000000002\", \"Version\":\"1.1.0\" }]", 2)]
[TestCase("[{\"Name\":\"X\", \"Maintainer\":\"Y\", \"UId\":\"00000000-0000-0000-0000-000000000001\", \"Version\":\"1.0.0\" },{\"Name\":\"X\", \"Maintainer\":\"Y\", \"UId\":\"00000000-0000-0000-0000-000000000002\", \"Version\":\"1.1.0\" },{\"Name\":\"X\", \"Maintainer\":\"Y\", \"UId\":\"00000000-0000-0000-0000-000000000003\", \"Version\":\"2.0.0\" }]", 3)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\"}]", 1)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\", \"Maintainer\":\"\"}]", 1)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\", \"Version\":\"\"}]", 1)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\", \"Maintainer\":\"\", \"Version\":\"\"}]", 1)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\", \"Maintainer\":\"Y\"}]", 1)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\", \"Version\":\"1.0.0\"}]", 1)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\", \"Maintainer\":\"Y\", \"Version\":\"1.0.0\"}]", 1)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000002\" }]", 2)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000002\", \"Maintainer\":\"\" }]", 2)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000002\", \"Version\":\"\" }]", 2)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000002\", \"Maintainer\":\"\", \"Version\":\"\" }]", 2)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\", \"Maintainer\":\"Y\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000002\", \"Maintainer\":\"Y\" }]", 2)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\", \"Version\":\"1.0.0\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000002\", \"Version\":\"1.1.0\" }]", 2)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\", \"Maintainer\":\"Y\", \"Version\":\"1.0.0\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000002\", \"Maintainer\":\"Y\", \"Version\":\"1.1.0\" }]", 2)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000002\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000003\" }]", 3)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000002\", \"Maintainer\":\"\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000003\" }]", 3)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000002\", \"Version\":\"\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000003\" }]", 3)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000002\", \"Maintainer\":\"\", \"Version\":\"\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000003\" }]", 3)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\", \"Maintainer\":\"Y\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000002\", \"Maintainer\":\"Y\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000003\", \"Maintainer\":\"Y\" }]", 3)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\", \"Version\":\"1.0.0\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000002\", \"Version\":\"1.1.0\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000003\", \"Version\":\"2.0.0\" }]", 3)]
[TestCase("[{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000001\", \"Maintainer\":\"Y\", \"Version\":\"1.0.0\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000002\", \"Maintainer\":\"Y\", \"Version\":\"1.1.0\" },{\"Name\":\"X\", \"UId\":\"00000000-0000-0000-0000-000000000003\", \"Maintainer\":\"Y\", \"Version\":\"2.0.0\" }]", 3)]
public void CreatePackageInfo_ReturnCorrectPackagesIfResponseCorrect(string responseData, int packageCount) {
IJsonConverter jsonConverter = Container.Resolve<IJsonConverter>();
var provider = new ApplicationPackageListProvider(jsonConverter);
Expand Down

0 comments on commit 93ab9c3

Please sign in to comment.