Ejemplo n.º 1
0
        public void TypeLicense_InvalidRepositoryFormat_CorrectResult()
        {
            const string expected   = "TestLicense";
            const string json       = "{\"name\":\"pinkie\",\"version\":\"2.0.0\",\"description\":\"Itty\",\"license\":\"TestLicense\",\"repository\":\"x/y\",\"author\":{\"name\":\"My Name\",\"email\":\"[email protected]\",\"url\":\"github.com/xx\"},\"engines\":{\"node\":\">=0.10.0\"},\"scripts\":{\"test\":\"xo && nyc mocha\",\"coverage\":\"nyc report --reporter=text-lcov | coveralls\"},\"files\":[\"index.js\"],\"keywords\":[\"promise\",\"promises\",\"es2015\",\"es6\"],\"devDependencies\":{\"coveralls\":\"^2.11.4\",\"mocha\":\"*\",\"nyc\":\"^3.2.2\",\"promises-aplus-tests\":\"*\",\"xo\":\"^0.10.1\"},\"_id\":\"[email protected]\",\"_npmVersion\":\"0.0.0-fake\",\"_nodeVersion\":\"0.0.0-fake\",\"_shasum\":\"11737918d16ab5859a90a5a031b6f7e0d6f245cc\",\"_npmUser\":{\"name\":\"npm\",\"email\":\"[email protected]\"},\"_from\":\".\",\"dist\":{\"shasum\":\"11737918d16ab5859a90a5a031b6f7e0d6f245cc\",\"tarball\":\"https://registry.npmjs.org/xx\"},\"maintainers\":[{\"name\":\"bb\",\"email\":\"[email protected]\"}],\"directories\":{}}";;
            var          npmPackage = NpmPackage.Deserialize(json);

            Assert.Equal(expected, npmPackage.License);
        }
Ejemplo n.º 2
0
        public void StringLicense_CorrectResult()
        {
            const string expected   = "TestLicense";
            string       json       = $"{{ \"license\": \"{expected}\" }}";
            var          npmPackage = NpmPackage.Deserialize(json);

            Assert.Equal(expected, npmPackage.License);
        }
Ejemplo n.º 3
0
        public void TypeLicense_CorrectResult()
        {
            const string expected   = "TestLicense";
            string       json       = $"{{ \"name\": \"test-name\", \"version\": \"1.0.0\", \"license\": {{ \"type\": \"{expected}\", \"url\": \"https://test\" }} }}";
            var          npmPackage = NpmPackage.Deserialize(json);

            Assert.Equal(expected, npmPackage.License);
        }