Beispiel #1
0
        public void ItInitializesLicenseFileContents()
        {
            // arrange
            var package = new Package
            {
                Version = "1.0.0",
            };
            var licenseFileContents = "It's a license";

            // act
            var model = new DisplayLicenseViewModel(package, licenseExpressionSegments: null, licenseFileContents: licenseFileContents);

            // assert
            Assert.Equal(licenseFileContents, model.LicenseFileContents);
        }
Beispiel #2
0
        public void ItInitializesLicenseExpressionSegments()
        {
            // arrange
            var package = new Package
            {
                Version = "1.0.0",
            };
            var segments = new List <CompositeLicenseExpressionSegment>();

            // act
            var model = new DisplayLicenseViewModel(package, licenseExpressionSegments: segments, licenseFileContents: null);

            // assert
            Assert.Equal(segments, model.LicenseExpressionSegments);
        }
Beispiel #3
0
        public void ItInitializesLicenseUrl(string licenseUrl, string expected)
        {
            // arrange
            var package = new Package
            {
                Version    = "1.0.0",
                LicenseUrl = licenseUrl
            };

            // act
            var model = new DisplayLicenseViewModel(package, licenseExpressionSegments: null, licenseFileContents: null);

            // assert
            Assert.Equal(expected, model.LicenseUrl);
        }
Beispiel #4
0
        public void ItInitializesLicenseFileTypeAndLicenseExpression(EmbeddedLicenseFileType embeddedLicenseType, string licenseExpression)
        {
            // arrange
            var package = new Package
            {
                Version             = "1.0.0",
                EmbeddedLicenseType = embeddedLicenseType,
                LicenseExpression   = licenseExpression,
            };

            // act
            var model = new DisplayLicenseViewModel(package, licenseExpressionSegments: null, licenseFileContents: null);

            // assert
            Assert.Equal(embeddedLicenseType, model.EmbeddedLicenseType);
            Assert.Equal(licenseExpression, model.LicenseExpression);
        }
Beispiel #5
0
        public void LicenseNamesAreParsedByCommas()
        {
            // arrange
            var licenseUrl = "https://mylicense/";
            var package    = new Package
            {
                LicenseUrl   = licenseUrl,
                Version      = "1.0.0",
                LicenseNames = "l1,l2, l3 ,l4  ,  l5 ",
            };

            // act
            var model = new DisplayLicenseViewModel(package, licenseExpressionSegments: null, licenseFileContents: null);

            // assert
            Assert.Equal(new string[] { "l1", "l2", "l3", "l4", "l5" }, model.LicenseNames);
            Assert.Equal(licenseUrl, model.LicenseUrl);
        }