From cd4eeba9beefe0856b0f18066a7cb00e3061d03d Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Thu, 14 Dec 2017 08:33:04 -0800 Subject: [PATCH] Clean-ups --- src/FS.Embedded.Manifest.Task/EmbeddedItem.cs | 5 +- src/FS.Embedded.Manifest.Task/Entry.cs | 5 +- .../Properties/launchSettings.json | 10 -- .../GenerateEmbeddedResourcesManifestTest.cs | 118 +++--------------- .../SetExtensions.cs | 19 +++ 5 files changed, 44 insertions(+), 113 deletions(-) delete mode 100644 src/FS.Embedded.Manifest.Task/Properties/launchSettings.json create mode 100644 test/FS.Embedded.Manifest.Task.Test/SetExtensions.cs diff --git a/src/FS.Embedded.Manifest.Task/EmbeddedItem.cs b/src/FS.Embedded.Manifest.Task/EmbeddedItem.cs index e96cc353..c2dbd58e 100644 --- a/src/FS.Embedded.Manifest.Task/EmbeddedItem.cs +++ b/src/FS.Embedded.Manifest.Task/EmbeddedItem.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; namespace Microsoft.Extensions.FileProviders.Embedded.Manifest.Task { diff --git a/src/FS.Embedded.Manifest.Task/Entry.cs b/src/FS.Embedded.Manifest.Task/Entry.cs index 6a3a767b..053b6b3b 100644 --- a/src/FS.Embedded.Manifest.Task/Entry.cs +++ b/src/FS.Embedded.Manifest.Task/Entry.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; diff --git a/src/FS.Embedded.Manifest.Task/Properties/launchSettings.json b/src/FS.Embedded.Manifest.Task/Properties/launchSettings.json deleted file mode 100644 index 6e57ccf2..00000000 --- a/src/FS.Embedded.Manifest.Task/Properties/launchSettings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "profiles": { - "FS.Embedded.Manifest.Task": { - "commandName": "Executable", - "executablePath": "C:\\Users\\jacalvar\\.dotnet\\x64\\dotnet.exe", - "commandLineArgs": "build", - "workingDirectory": "C:\\work\\FileSystem\\test\\ClassLibraryWithEmbeddedResources" - } - } -} \ No newline at end of file diff --git a/test/FS.Embedded.Manifest.Task.Test/GenerateEmbeddedResourcesManifestTest.cs b/test/FS.Embedded.Manifest.Task.Test/GenerateEmbeddedResourcesManifestTest.cs index 42f16160..92a5f7a7 100644 --- a/test/FS.Embedded.Manifest.Task.Test/GenerateEmbeddedResourcesManifestTest.cs +++ b/test/FS.Embedded.Manifest.Task.Test/GenerateEmbeddedResourcesManifestTest.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.Collections; using System.Collections.Generic; using System.IO; @@ -340,11 +343,11 @@ public override XmlWriter GetXmlWriter(EmbeddedItem manifestItem, XmlWriterSetti private ITaskItem[] CreateEmbeddedResource(params IDictionary[] files) => files.Select(f => new TestTaskItem(f)).ToArray(); - private static IDictionary CreateMetadata( - string targetPath, - string manifestResourceName = null, - string logicalName = null - ) => + private static IDictionary + CreateMetadata( + string targetPath, + string manifestResourceName = null, + string logicalName = null) => new Dictionary { ["TargetPath"] = targetPath, @@ -398,106 +401,19 @@ public void SetMetadata(string metadataName, string metadataValue) } } - private IDictionary[] GetSampleIdentityEmbeddedMetadata() - { - return new[]{ - CreateMetadata(@"Areas\Identity\Views\_ViewImports.cshtml"), - CreateMetadata(@"Areas\Identity\Views\_ViewStart.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Account\AccessDenied.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Account\ConfirmEmail.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Account\ExternalLogin.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Account\ForgotPassword.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Account\ForgotPasswordConfirmation.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Account\Lockout.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Account\Login.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Account\LoginWith2fa.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Account\LoginWithRecoveryCode.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Account\Register.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Account\ResetPassword.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Account\ResetPasswordConfirmation.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Account\SignedOut.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Manage\ChangePassword.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Manage\Disable2fa.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Manage\EnableAuthenticator.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Manage\ExternalLogins.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Manage\GenerateRecoveryCodes.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Manage\Index.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Manage\ResetAuthenticator.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Manage\SetPassword.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Manage\TwoFactorAuthentication.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Manage\_Layout.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Manage\_ManageNav.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Manage\_StatusMessage.cshtml"), - CreateMetadata(@"Areas\Identity\Views\Manage\_ViewImports.cshtml"), - CreateMetadata(@"Identity\css\site.css"), - CreateMetadata(@"Identity\css\site.min.css"), - CreateMetadata(@"Identity\images\banner1.svg"), - CreateMetadata(@"Identity\images\banner2.svg"), - CreateMetadata(@"Identity\images\banner3.svg"), - CreateMetadata(@"Identity\images\banner4.svg"), - CreateMetadata(@"Identity\js\site.js"), - CreateMetadata(@"Identity\js\site.min.js"), - CreateMetadata(@"Identity\lib\bootstrap\.bower.json"), - CreateMetadata(@"Identity\lib\bootstrap\LICENSE"), - CreateMetadata(@"Identity\lib\bootstrap\dist\css\bootstrap-theme.css"), - CreateMetadata(@"Identity\lib\bootstrap\dist\css\bootstrap-theme.css.map"), - CreateMetadata(@"Identity\lib\bootstrap\dist\css\bootstrap-theme.min.css"), - CreateMetadata(@"Identity\lib\bootstrap\dist\css\bootstrap-theme.min.css.map"), - CreateMetadata(@"Identity\lib\bootstrap\dist\css\bootstrap.css"), - CreateMetadata(@"Identity\lib\bootstrap\dist\css\bootstrap.css.map"), - CreateMetadata(@"Identity\lib\bootstrap\dist\css\bootstrap.min.css"), - CreateMetadata(@"Identity\lib\bootstrap\dist\css\bootstrap.min.css.map"), - CreateMetadata(@"Identity\lib\bootstrap\dist\fonts\glyphicons-halflings-regular.eot"), - CreateMetadata(@"Identity\lib\bootstrap\dist\fonts\glyphicons-halflings-regular.svg"), - CreateMetadata(@"Identity\lib\bootstrap\dist\fonts\glyphicons-halflings-regular.ttf"), - CreateMetadata(@"Identity\lib\bootstrap\dist\fonts\glyphicons-halflings-regular.woff"), - CreateMetadata(@"Identity\lib\bootstrap\dist\fonts\glyphicons-halflings-regular.woff2"), - CreateMetadata(@"Identity\lib\bootstrap\dist\js\bootstrap.js"), - CreateMetadata(@"Identity\lib\bootstrap\dist\js\bootstrap.min.js"), - CreateMetadata(@"Identity\lib\bootstrap\dist\js\npm.js"), - CreateMetadata(@"Identity\lib\jquery\.bower.json"), - CreateMetadata(@"Identity\lib\jquery\LICENSE.txt"), - CreateMetadata(@"Identity\lib\jquery\dist\jquery.js"), - CreateMetadata(@"Identity\lib\jquery\dist\jquery.min.js"), - CreateMetadata(@"Identity\lib\jquery\dist\jquery.min.map"), - CreateMetadata(@"Identity\lib\jquery-validation\.bower.json"), - CreateMetadata(@"Identity\lib\jquery-validation\LICENSE.md"), - CreateMetadata(@"Identity\lib\jquery-validation\dist\additional-methods.js"), - CreateMetadata(@"Identity\lib\jquery-validation\dist\additional-methods.min.js"), - CreateMetadata(@"Identity\lib\jquery-validation\dist\jquery.validate.js"), - CreateMetadata(@"Identity\lib\jquery-validation\dist\jquery.validate.min.js"), - CreateMetadata(@"Identity\lib\jquery-validation-unobtrusive\.bower.json"), - CreateMetadata(@"Identity\lib\jquery-validation-unobtrusive\jquery.validate.unobtrusive.js"), - CreateMetadata(@"Identity\lib\jquery-validation-unobtrusive\jquery.validate.unobtrusive.min.js") - }; - } - } - - internal class ManifestComparer : IEqualityComparer - { - public static IEqualityComparer Instance { get; } = new ManifestComparer(); - - public bool Equals(Manifest x, Manifest y) - { - return x.Root.Equals(y.Root); - } - - public int GetHashCode(Manifest obj) + private class ManifestComparer : IEqualityComparer { - return obj.Root.GetHashCode(); - } - } + public static IEqualityComparer Instance { get; } = new ManifestComparer(); - static class SetExtensions - { - public static Entry AddRange(this Entry source, params Entry[] elements) - { - foreach (var element in elements) + public bool Equals(Manifest x, Manifest y) { - source.Children.Add(element); + return x.Root.Equals(y.Root); } - return source; + public int GetHashCode(Manifest obj) + { + return obj.Root.GetHashCode(); + } } } } diff --git a/test/FS.Embedded.Manifest.Task.Test/SetExtensions.cs b/test/FS.Embedded.Manifest.Task.Test/SetExtensions.cs new file mode 100644 index 00000000..3f1e77d3 --- /dev/null +++ b/test/FS.Embedded.Manifest.Task.Test/SetExtensions.cs @@ -0,0 +1,19 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + + +namespace Microsoft.Extensions.FileProviders.Embedded.Manifest.Task +{ + internal static class SetExtensions + { + public static Entry AddRange(this Entry source, params Entry[] elements) + { + foreach (var element in elements) + { + source.Children.Add(element); + } + + return source; + } + } +}