Exemplo n.º 1
0
        public async Task Basic_NuSpecPropertiesMatchProjectProperties()
        {
            nuproj.CreateMockContentFiles();
            var result = await MSBuild.ExecuteAsync(nuproj.CreateProjectInstance(), this.logger);

            result.AssertSuccessfulBuild();

            var package = await nuproj.GetPackageAsync();

            var properties = new Dictionary <string, object>
            {
                { "Id", package.Id },
                { "Version", package.Version },
                { "Authors", package.Authors },
                { "RequireLicenseAcceptance", package.RequireLicenseAcceptance },
                { "Description", package.Description },
                { "ProjectUrl", package.ProjectUrl },
                { "LicenseUrl", package.LicenseUrl },
            };

            foreach (var property in properties)
            {
                var propertyName      = property.Key;
                var expectedValueText = nuproj.GetPropertyValue(propertyName);
                var actualValue       = property.Value;
                var actualValueText   = actualValue == null
                                        ? string.Empty
                                        : actualValue is IEnumerable <string>
                                        ?((IEnumerable <string>)actualValue).First()
                                            : actualValue.ToString();

                Assert.Equal(expectedValueText, actualValueText);
            }
        }