Transition `HashCodeCombiner` to use the `aspnet/Common` variation.

- Updated `LocationTagged<TValue>` to handle `null` implicit values.
- Removed `InternalsVisibleTo` declaration on `Microsoft.AspNet.Razor` to the runtime test project.
- Updated `TagHelperDescriptor` tests to utilize helper methods to construct `TagHelperDescriptor`s. This was needed since the `InternalsVisibleTo` declaration was removed.

#449
This commit is contained in:
N. Taylor Mullen 2015-07-28 10:45:08 -07:00
parent b66da76c5c
commit e722f90481
24 changed files with 20 additions and 84 deletions

View File

@ -4,7 +4,7 @@
using System;
using System.Linq;
using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.Internal.Web.Utils;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Test.Internal
{

View File

@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.Internal.Web.Utils;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Test.Internal
{

View File

@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.Internal.Web.Utils;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Test.Internal
{

View File

@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.Internal.Web.Utils;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Test.Internal
{

View File

@ -5,7 +5,7 @@ using System;
using System.Globalization;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Text;
using Microsoft.Internal.Web.Utils;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Chunks.Generators
{

View File

@ -4,7 +4,7 @@
using System.Globalization;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Text;
using Microsoft.Internal.Web.Utils;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Chunks.Generators
{

View File

@ -4,7 +4,6 @@
using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Framework.Internal;
using Microsoft.Internal.Web.Utils;
namespace Microsoft.AspNet.Razor.CodeGenerators
{

View File

@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Globalization;
using Microsoft.Internal.Web.Utils;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.CodeGenerators
{

View File

@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Globalization;
using Microsoft.Internal.Web.Utils;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.CodeGenerators
{

View File

@ -1,61 +0,0 @@
// 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.Collections;
using System.Collections.Generic;
namespace Microsoft.Internal.Web.Utils
{
public class HashCodeCombiner
{
private long _combinedHash64 = 0x1505L;
public int CombinedHash
{
get { return _combinedHash64.GetHashCode(); }
}
public HashCodeCombiner Add(IEnumerable e)
{
if (e == null)
{
Add(0);
}
else
{
var count = 0;
foreach (object o in e)
{
Add(o);
count++;
}
Add(count);
}
return this;
}
public HashCodeCombiner Add(int i)
{
_combinedHash64 = ((_combinedHash64 << 5) + _combinedHash64) ^ i;
return this;
}
public HashCodeCombiner Add(object o)
{
var hashCode = (o != null) ? o.GetHashCode() : 0;
Add(hashCode);
return this;
}
public HashCodeCombiner Add<TValue>(TValue value, IEqualityComparer<TValue> comparer)
{
var hashCode = value != null ? comparer.GetHashCode(value) : 0;
return Add(hashCode);
}
public static HashCodeCombiner Start()
{
return new HashCodeCombiner();
}
}
}

View File

@ -7,7 +7,7 @@ using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNet.Razor.Editor;
using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols;
using Microsoft.Internal.Web.Utils;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Parser.SyntaxTree
{

View File

@ -12,7 +12,7 @@ using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols;
using Microsoft.Internal.Web.Utils;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Editor
{

View File

@ -8,7 +8,7 @@ using System.Globalization;
using System.Linq;
using Microsoft.AspNet.Razor.Chunks.Generators;
using Microsoft.AspNet.Razor.Text;
using Microsoft.Internal.Web.Utils;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Parser.SyntaxTree
{

View File

@ -7,7 +7,7 @@ using System.Globalization;
using System.Linq;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.Internal.Web.Utils;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Parser.TagHelpers
{

View File

@ -3,7 +3,7 @@
using System;
using System.Globalization;
using Microsoft.Internal.Web.Utils;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor
{

View File

@ -5,7 +5,6 @@ using System;
using System.Globalization;
using Microsoft.AspNet.Razor.Text;
using Microsoft.Framework.Internal;
using Microsoft.Internal.Web.Utils;
namespace Microsoft.AspNet.Razor
{

View File

@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Framework.Internal;
using Microsoft.Internal.Web.Utils;
namespace Microsoft.AspNet.Razor.TagHelpers
{

View File

@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using Microsoft.Framework.Internal;
using Microsoft.Internal.Web.Utils;
namespace Microsoft.AspNet.Razor.TagHelpers
{

View File

@ -5,7 +5,6 @@ using System;
using System.Diagnostics;
using System.Globalization;
using Microsoft.Framework.Internal;
using Microsoft.Internal.Web.Utils;
namespace Microsoft.AspNet.Razor.Text
{
@ -79,7 +78,7 @@ namespace Microsoft.AspNet.Razor.Text
public static implicit operator TValue(LocationTagged<TValue> value)
{
return value.Value;
return value == null ? default(TValue) : value.Value;
}
public static bool operator ==(LocationTagged<TValue> left, LocationTagged<TValue> right)

View File

@ -7,7 +7,6 @@ using System.Globalization;
using System.Text;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.Framework.Internal;
using Microsoft.Internal.Web.Utils;
namespace Microsoft.AspNet.Razor.Text
{

View File

@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using Microsoft.Framework.Internal;
using Microsoft.Internal.Web.Utils;
namespace Microsoft.AspNet.Razor.Tokenizer.Symbols
{

View File

@ -6,6 +6,10 @@
"url": "git://github.com/aspnet/razor"
},
"dependencies": {
"Microsoft.Framework.HashCodeCombiner.Sources": {
"type": "build",
"version": "1.0.0-*"
},
"Microsoft.Framework.NotNullAttribute.Sources": {
"type": "build",
"version": "1.0.0-*"

View File

@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.Internal.Web.Utils;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Test.Generator
{

View File

@ -8,7 +8,7 @@ using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Parser.TagHelpers;
using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.Internal.Web.Utils;
using Microsoft.Framework.Internal;
#if !DNXCORE50
using Moq;
#endif