Skip to content
This repository has been archived by the owner on Nov 6, 2018. It is now read-only.

Commit

Permalink
Clean-ups
Browse files Browse the repository at this point in the history
  • Loading branch information
javiercn committed Dec 14, 2017
1 parent 8a62b85 commit cd4eeba
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 113 deletions.
5 changes: 4 additions & 1 deletion src/FS.Embedded.Manifest.Task/EmbeddedItem.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down
5 changes: 4 additions & 1 deletion src/FS.Embedded.Manifest.Task/Entry.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
10 changes: 0 additions & 10 deletions src/FS.Embedded.Manifest.Task/Properties/launchSettings.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -340,11 +343,11 @@ public override XmlWriter GetXmlWriter(EmbeddedItem manifestItem, XmlWriterSetti
private ITaskItem[] CreateEmbeddedResource(params IDictionary<string, string>[] files) =>
files.Select(f => new TestTaskItem(f)).ToArray();

private static IDictionary<string, string> CreateMetadata(
string targetPath,
string manifestResourceName = null,
string logicalName = null
) =>
private static IDictionary<string, string>
CreateMetadata(
string targetPath,
string manifestResourceName = null,
string logicalName = null) =>
new Dictionary<string, string>
{
["TargetPath"] = targetPath,
Expand Down Expand Up @@ -398,106 +401,19 @@ public void SetMetadata(string metadataName, string metadataValue)
}
}

private IDictionary<string, string>[] 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<Manifest>
{
public static IEqualityComparer<Manifest> 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<Manifest>
{
return obj.Root.GetHashCode();
}
}
public static IEqualityComparer<Manifest> 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();
}
}
}
}
19 changes: 19 additions & 0 deletions test/FS.Embedded.Manifest.Task.Test/SetExtensions.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
}

0 comments on commit cd4eeba

Please sign in to comment.