diff --git a/HttpAbstractions.sln b/HttpAbstractions.sln index 39f29673eb..bbb59df0db 100644 --- a/HttpAbstractions.sln +++ b/HttpAbstractions.sln @@ -47,10 +47,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{982F EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SampleApp", "samples\SampleApp\SampleApp.xproj", "{1D0764B4-1DEB-4232-A714-D4B7E846918A}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.Primitives", "src\Microsoft.Framework.Primitives\Microsoft.Framework.Primitives.xproj", "{E5FACCD4-6327-43AA-80A9-AE6F4A3BFE6A}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.Primitives.Tests", "test\Microsoft.Framework.Primitives.Tests\Microsoft.Framework.Primitives.Tests.xproj", "{61F72E92-B3AE-4A10-B838-44F80AED40AE}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Html.Abstractions.Test", "test\Microsoft.AspNet.Html.Abstractions.Test\Microsoft.AspNet.Html.Abstractions.Test.xproj", "{2D187B88-94BD-4A39-AC97-F8F8B9363301}" EndProject Global @@ -267,30 +263,6 @@ Global {1D0764B4-1DEB-4232-A714-D4B7E846918A}.Release|Mixed Platforms.Build.0 = Release|Any CPU {1D0764B4-1DEB-4232-A714-D4B7E846918A}.Release|x86.ActiveCfg = Release|Any CPU {1D0764B4-1DEB-4232-A714-D4B7E846918A}.Release|x86.Build.0 = Release|Any CPU - {E5FACCD4-6327-43AA-80A9-AE6F4A3BFE6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E5FACCD4-6327-43AA-80A9-AE6F4A3BFE6A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E5FACCD4-6327-43AA-80A9-AE6F4A3BFE6A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {E5FACCD4-6327-43AA-80A9-AE6F4A3BFE6A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {E5FACCD4-6327-43AA-80A9-AE6F4A3BFE6A}.Debug|x86.ActiveCfg = Debug|Any CPU - {E5FACCD4-6327-43AA-80A9-AE6F4A3BFE6A}.Debug|x86.Build.0 = Debug|Any CPU - {E5FACCD4-6327-43AA-80A9-AE6F4A3BFE6A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E5FACCD4-6327-43AA-80A9-AE6F4A3BFE6A}.Release|Any CPU.Build.0 = Release|Any CPU - {E5FACCD4-6327-43AA-80A9-AE6F4A3BFE6A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {E5FACCD4-6327-43AA-80A9-AE6F4A3BFE6A}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {E5FACCD4-6327-43AA-80A9-AE6F4A3BFE6A}.Release|x86.ActiveCfg = Release|Any CPU - {E5FACCD4-6327-43AA-80A9-AE6F4A3BFE6A}.Release|x86.Build.0 = Release|Any CPU - {61F72E92-B3AE-4A10-B838-44F80AED40AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {61F72E92-B3AE-4A10-B838-44F80AED40AE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {61F72E92-B3AE-4A10-B838-44F80AED40AE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {61F72E92-B3AE-4A10-B838-44F80AED40AE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {61F72E92-B3AE-4A10-B838-44F80AED40AE}.Debug|x86.ActiveCfg = Debug|Any CPU - {61F72E92-B3AE-4A10-B838-44F80AED40AE}.Debug|x86.Build.0 = Debug|Any CPU - {61F72E92-B3AE-4A10-B838-44F80AED40AE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {61F72E92-B3AE-4A10-B838-44F80AED40AE}.Release|Any CPU.Build.0 = Release|Any CPU - {61F72E92-B3AE-4A10-B838-44F80AED40AE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {61F72E92-B3AE-4A10-B838-44F80AED40AE}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {61F72E92-B3AE-4A10-B838-44F80AED40AE}.Release|x86.ActiveCfg = Release|Any CPU - {61F72E92-B3AE-4A10-B838-44F80AED40AE}.Release|x86.Build.0 = Release|Any CPU {2D187B88-94BD-4A39-AC97-F8F8B9363301}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2D187B88-94BD-4A39-AC97-F8F8B9363301}.Debug|Any CPU.Build.0 = Debug|Any CPU {2D187B88-94BD-4A39-AC97-F8F8B9363301}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -327,8 +299,6 @@ Global {BE9112CB-D87D-4080-9CC3-24492D49CBE6} = {A5A15F1C-885A-452A-A731-B0173DDBD913} {68A28E4A-3ADE-4187-9625-4FF185887CB3} = {A5A15F1C-885A-452A-A731-B0173DDBD913} {1D0764B4-1DEB-4232-A714-D4B7E846918A} = {982F09D8-621E-4872-BA7B-BBDEA47D1EFD} - {E5FACCD4-6327-43AA-80A9-AE6F4A3BFE6A} = {A5A15F1C-885A-452A-A731-B0173DDBD913} - {61F72E92-B3AE-4A10-B838-44F80AED40AE} = {F31FF137-390C-49BF-A3BD-7C6ED3597C21} {2D187B88-94BD-4A39-AC97-F8F8B9363301} = {F31FF137-390C-49BF-A3BD-7C6ED3597C21} EndGlobalSection EndGlobal diff --git a/src/Microsoft.Framework.Primitives/Microsoft.Framework.Primitives.xproj b/src/Microsoft.Framework.Primitives/Microsoft.Framework.Primitives.xproj deleted file mode 100644 index f7b40aaa14..0000000000 --- a/src/Microsoft.Framework.Primitives/Microsoft.Framework.Primitives.xproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - e5faccd4-6327-43aa-80a9-ae6f4a3bfe6a - Microsoft.AspNet.Primitives - ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin\$(MSBuildProjectName)\ - - - - 2.0 - - - diff --git a/src/Microsoft.Framework.Primitives/Properties/AssemblyInfo.cs b/src/Microsoft.Framework.Primitives/Properties/AssemblyInfo.cs deleted file mode 100644 index b2437d9ad6..0000000000 --- a/src/Microsoft.Framework.Primitives/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,8 +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.Reflection; -using System.Resources; - -[assembly: AssemblyMetadata("Serviceable", "True")] -[assembly: NeutralResourcesLanguage("en-us")] \ No newline at end of file diff --git a/src/Microsoft.Framework.Primitives/StringValues.cs b/src/Microsoft.Framework.Primitives/StringValues.cs deleted file mode 100644 index 79a8e6d006..0000000000 --- a/src/Microsoft.Framework.Primitives/StringValues.cs +++ /dev/null @@ -1,312 +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; -using System.Collections; -using System.Collections.Generic; - -namespace Microsoft.Framework.Primitives -{ - /// - /// Represents zero/null, one, or many strings in an efficient way. - /// - public struct StringValues : IList, IReadOnlyList - { - private static readonly string[] EmptyArray = new string[0]; - public static readonly StringValues Empty = new StringValues(EmptyArray); - - private readonly string _value; - private readonly string[] _values; - - public StringValues(string value) - { - _value = value; - _values = null; - } - - public StringValues(string[] values) - { - _value = null; - _values = values; - } - - public static implicit operator StringValues(string value) - { - return new StringValues(value); - } - - public static implicit operator StringValues(string[] values) - { - return new StringValues(values); - } - - public static implicit operator string (StringValues values) - { - return values.GetStringValue(); - } - - public static implicit operator string[] (StringValues value) - { - return value.GetArrayValue(); - } - - public int Count => _values?.Length ?? (_value != null ? 1 : 0); - - bool ICollection.IsReadOnly - { - get { return true; } - } - - string IList.this[int index] - { - get { return this[index]; } - set { throw new NotSupportedException(); } - } - - public string this[int index] - { - get - { - if (_values != null) - { - return _values[index]; // may throw - } - if (index == 0 && _value != null) - { - return _value; - } - return EmptyArray[0]; // throws - } - } - - public override string ToString() - { - return GetStringValue() ?? string.Empty; - } - - private string GetStringValue() - { - if (_values == null) - { - return _value; - } - switch (_values.Length) - { - case 0: return null; - case 1: return _values[0]; - default: return string.Join(",", _values); - } - } - - public string[] ToArray() - { - return GetArrayValue() ?? EmptyArray; - } - - private string[] GetArrayValue() - { - if (_value != null) - { - return new[] { _value }; - } - return _values; - } - - int IList.IndexOf(string item) - { - return IndexOf(item); - } - - private int IndexOf(string item) - { - if (_values != null) - { - var values = _values; - for (int i = 0; i < values.Length; i++) - { - if (string.Equals(values[i], item, StringComparison.Ordinal)) - { - return i; - } - } - return -1; - } - - if (_value != null) - { - return string.Equals(_value, item, StringComparison.Ordinal) ? 0 : -1; - } - - return -1; - } - - bool ICollection.Contains(string item) - { - return IndexOf(item) >= 0; - } - - void ICollection.CopyTo(string[] array, int arrayIndex) - { - CopyTo(array, arrayIndex); - } - - private void CopyTo(string[] array, int arrayIndex) - { - if (_values != null) - { - Array.Copy(_values, 0, array, arrayIndex, _values.Length); - return; - } - - if (_value != null) - { - if (array == null) - { - throw new ArgumentNullException(nameof(array)); - } - if (arrayIndex < 0) - { - throw new ArgumentOutOfRangeException(nameof(arrayIndex)); - } - if (array.Length - arrayIndex < 1) - { - throw new ArgumentException( - $"'{nameof(array)}' is not long enough to copy all the items in the collection. Check '{nameof(arrayIndex)}' and '{nameof(array)}' length."); - } - - array[arrayIndex] = _value; - } - } - - void ICollection.Add(string item) - { - throw new NotSupportedException(); - } - - void IList.Insert(int index, string item) - { - throw new NotSupportedException(); - } - - bool ICollection.Remove(string item) - { - throw new NotSupportedException(); - } - - void IList.RemoveAt(int index) - { - throw new NotSupportedException(); - } - - void ICollection.Clear() - { - throw new NotSupportedException(); - } - - public Enumerator GetEnumerator() - { - return new Enumerator(this); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - public static bool IsNullOrEmpty(StringValues value) - { - if (value._values == null) - { - return string.IsNullOrEmpty(value._value); - } - switch (value._values.Length) - { - case 0: return true; - case 1: return string.IsNullOrEmpty(value._values[0]); - default: return false; - } - } - - public static StringValues Concat(StringValues values1, StringValues values2) - { - var count1 = values1.Count; - var count2 = values2.Count; - - if (count1 == 0) - { - return values2; - } - - if (count2 == 0) - { - return values1; - } - - var combined = new string[count1 + count2]; - values1.CopyTo(combined, 0); - values2.CopyTo(combined, count1); - return new StringValues(combined); - } - - public struct Enumerator : IEnumerator - { - private readonly StringValues _values; - private string _current; - private int _index; - - public Enumerator(StringValues values) - { - _values = values; - _current = null; - _index = 0; - } - - public bool MoveNext() - { - var values = _values._values; - if (values != null) - { - if (_index < values.Length) - { - _current = values[_index]; - _index++; - return true; - } - - _current = null; - return false; - } - - var value = _values._value; - if (value != null && _index == 0) - { - _current = value; - _index = -1; // sentinel value - return true; - } - - _current = null; - return false; - } - - public string Current => _current; - - object IEnumerator.Current => _current; - - void IEnumerator.Reset() - { - _current = null; - _index = 0; - } - - void IDisposable.Dispose() - { - } - } - } -} diff --git a/src/Microsoft.Framework.Primitives/project.json b/src/Microsoft.Framework.Primitives/project.json deleted file mode 100644 index 4957eeb224..0000000000 --- a/src/Microsoft.Framework.Primitives/project.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "1.0.0-*", - "description": "Contains primitive types such as StringValues.", - "repository": { - "type": "git", - "url": "git://github.com/aspnet/httpabstractions" - }, - "compilationOptions": { - "warningsAsErrors": true - }, - "frameworks": { - "net451": { }, - "dnx451": { }, - "dnxcore50": { - "dependencies": { - "System.Collections": "4.0.11-beta-*", - "System.Resources.ResourceManager": "4.0.1-beta-" - } - } - } -} diff --git a/test/Microsoft.Framework.Primitives.Tests/Microsoft.Framework.Primitives.Tests.xproj b/test/Microsoft.Framework.Primitives.Tests/Microsoft.Framework.Primitives.Tests.xproj deleted file mode 100644 index f1a2ba4182..0000000000 --- a/test/Microsoft.Framework.Primitives.Tests/Microsoft.Framework.Primitives.Tests.xproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 61f72e92-b3ae-4a10-b838-44f80aed40ae - Microsoft.AspNet.Primitives.Tests - ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin\$(MSBuildProjectName)\ - - - 2.0 - - - - - - \ No newline at end of file diff --git a/test/Microsoft.Framework.Primitives.Tests/StringValuesTests.cs b/test/Microsoft.Framework.Primitives.Tests/StringValuesTests.cs deleted file mode 100644 index 184fa3f7da..0000000000 --- a/test/Microsoft.Framework.Primitives.Tests/StringValuesTests.cs +++ /dev/null @@ -1,306 +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; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using Xunit; - -namespace Microsoft.Framework.Primitives -{ - public class StringValuesTests - { - public static TheoryData DefaultOrNullStringValues - { - get - { - return new TheoryData - { - new StringValues(), - new StringValues((string)null), - new StringValues((string[])null), - (string)null, - (string[])null - }; - } - } - - public static TheoryData EmptyStringValues - { - get - { - return new TheoryData - { - StringValues.Empty, - new StringValues(new string[0]), - new string[0] - }; - } - } - - public static TheoryData FilledStringValues - { - get - { - return new TheoryData - { - new StringValues("abc"), - new StringValues(new[] { "abc" }), - new StringValues(new[] { "abc", "bcd" }), - new StringValues(new[] { "abc", "bcd", "foo" }), - "abc", - new[] { "abc" }, - new[] { "abc", "bcd" }, - new[] { "abc", "bcd", "foo" } - }; - } - } - - public static TheoryData FilledStringValuesWithExpected - { - get - { - return new TheoryData - { - { new StringValues("abc"), new[] { "abc" } }, - { new StringValues(new[] { "abc" }), new[] { "abc" } }, - { new StringValues(new[] { "abc", "bcd" }), new[] { "abc", "bcd" } }, - { new StringValues(new[] { "abc", "bcd", "foo" }), new[] { "abc", "bcd", "foo" } }, - { "abc", new[] { "abc" } }, - { new[] { "abc" }, new[] { "abc" } }, - { new[] { "abc", "bcd" }, new[] { "abc", "bcd" } }, - { new[] { "abc", "bcd", "foo" }, new[] { "abc", "bcd", "foo" } } - }; - } - } - - [Theory] - [MemberData(nameof(DefaultOrNullStringValues))] - [MemberData(nameof(EmptyStringValues))] - [MemberData(nameof(FilledStringValues))] - public void IsReadOnly_True(StringValues stringValues) - { - Assert.True(((IList)stringValues).IsReadOnly); - Assert.Throws(() => ((IList)stringValues)[0] = string.Empty); - Assert.Throws(() => ((ICollection)stringValues).Add(string.Empty)); - Assert.Throws(() => ((IList)stringValues).Insert(0, string.Empty)); - Assert.Throws(() => ((ICollection)stringValues).Remove(string.Empty)); - Assert.Throws(() => ((IList)stringValues).RemoveAt(0)); - Assert.Throws(() => ((ICollection)stringValues).Clear()); - } - - [Theory] - [MemberData(nameof(DefaultOrNullStringValues))] - public void DefaultOrNull_ExpectedValues(StringValues stringValues) - { - Assert.Null((string[])stringValues); - } - - [Theory] - [MemberData(nameof(DefaultOrNullStringValues))] - [MemberData(nameof(EmptyStringValues))] - public void DefaultNullOrEmpty_ExpectedValues(StringValues stringValues) - { - Assert.Equal(0, stringValues.Count); - Assert.Null((string)stringValues); - Assert.Equal((string)null, stringValues); - Assert.Equal(string.Empty, stringValues.ToString()); - Assert.Equal(new string[0], stringValues.ToArray()); - - Assert.True(StringValues.IsNullOrEmpty(stringValues)); - Assert.Throws(() => stringValues[0]); - Assert.Throws(() => ((IList)stringValues)[0]); - Assert.Equal(string.Empty, stringValues.ToString()); - Assert.Equal(-1, ((IList)stringValues).IndexOf(null)); - Assert.Equal(-1, ((IList)stringValues).IndexOf(string.Empty)); - Assert.Equal(-1, ((IList)stringValues).IndexOf("not there")); - Assert.False(((ICollection)stringValues).Contains(null)); - Assert.False(((ICollection)stringValues).Contains(string.Empty)); - Assert.False(((ICollection)stringValues).Contains("not there")); - Assert.Equal(0, stringValues.Count()); - } - - [Fact] - public void ImplicitStringConverter_Works() - { - string nullString = null; - StringValues stringValues = nullString; - Assert.Equal(0, stringValues.Count); - Assert.Null((string)stringValues); - Assert.Null((string[])stringValues); - - string aString = "abc"; - stringValues = aString; - Assert.Equal(1, stringValues.Count); - Assert.Equal(aString, stringValues); - Assert.Equal(aString, stringValues[0]); - Assert.Equal(aString, ((IList)stringValues)[0]); - Assert.Equal(new string[] { aString }, stringValues); - } - - [Fact] - public void ImplicitStringArrayConverter_Works() - { - string[] nullStringArray = null; - StringValues stringValues = nullStringArray; - Assert.Equal(0, stringValues.Count); - Assert.Null((string)stringValues); - Assert.Null((string[])stringValues); - - string aString = "abc"; - string[] aStringArray = new[] { aString }; - stringValues = aStringArray; - Assert.Equal(1, stringValues.Count); - Assert.Equal(aString, stringValues); - Assert.Equal(aString, stringValues[0]); - Assert.Equal(aString, ((IList)stringValues)[0]); - Assert.Equal(aStringArray, stringValues); - - aString = "abc"; - string bString = "bcd"; - aStringArray = new[] { aString, bString }; - stringValues = aStringArray; - Assert.Equal(2, stringValues.Count); - Assert.Equal("abc,bcd", stringValues); - Assert.Equal(aStringArray, stringValues); - } - - [Theory] - [MemberData(nameof(DefaultOrNullStringValues))] - [MemberData(nameof(EmptyStringValues))] - public void DefaultNullOrEmpty_Enumerator(StringValues stringValues) - { - var e = stringValues.GetEnumerator(); - Assert.Null(e.Current); - Assert.False(e.MoveNext()); - Assert.Null(e.Current); - Assert.False(e.MoveNext()); - Assert.False(e.MoveNext()); - Assert.False(e.MoveNext()); - - var e1 = ((IEnumerable)stringValues).GetEnumerator(); - Assert.Null(e1.Current); - Assert.False(e1.MoveNext()); - Assert.Null(e1.Current); - Assert.False(e1.MoveNext()); - Assert.False(e1.MoveNext()); - Assert.False(e1.MoveNext()); - - var e2 = ((IEnumerable)stringValues).GetEnumerator(); - Assert.Null(e2.Current); - Assert.False(e2.MoveNext()); - Assert.Null(e2.Current); - Assert.False(e2.MoveNext()); - Assert.False(e2.MoveNext()); - Assert.False(e2.MoveNext()); - } - - [Theory] - [MemberData(nameof(FilledStringValuesWithExpected))] - public void Enumerator(StringValues stringValues, string[] expected) - { - var e = stringValues.GetEnumerator(); - Assert.Null(e.Current); - for (int i = 0; i < expected.Length; i++) - { - Assert.True(e.MoveNext()); - Assert.Equal(expected[i], e.Current); - } - Assert.False(e.MoveNext()); - Assert.False(e.MoveNext()); - Assert.False(e.MoveNext()); - - var e1 = ((IEnumerable)stringValues).GetEnumerator(); - Assert.Null(e1.Current); - for (int i = 0; i < expected.Length; i++) - { - Assert.True(e1.MoveNext()); - Assert.Equal(expected[i], e1.Current); - } - Assert.False(e1.MoveNext()); - Assert.False(e1.MoveNext()); - Assert.False(e1.MoveNext()); - - var e2 = ((IEnumerable)stringValues).GetEnumerator(); - Assert.Null(e2.Current); - for (int i = 0; i < expected.Length; i++) - { - Assert.True(e2.MoveNext()); - Assert.Equal(expected[i], e2.Current); - } - Assert.False(e2.MoveNext()); - Assert.False(e2.MoveNext()); - Assert.False(e2.MoveNext()); - } - - [Theory] - [MemberData(nameof(FilledStringValuesWithExpected))] - public void IndexOf(StringValues stringValues, string[] expected) - { - IList list = stringValues; - Assert.Equal(-1, list.IndexOf("not there")); - for (int i = 0; i < expected.Length; i++) - { - Assert.Equal(i, list.IndexOf(expected[i])); - } - } - - [Theory] - [MemberData(nameof(FilledStringValuesWithExpected))] - public void Contains(StringValues stringValues, string[] expected) - { - ICollection collection = stringValues; - Assert.False(collection.Contains("not there")); - for (int i = 0; i < expected.Length; i++) - { - Assert.True(collection.Contains(expected[i])); - } - } - - [Theory] - [MemberData(nameof(FilledStringValuesWithExpected))] - public void CopyTo(StringValues stringValues, string[] expected) - { - ICollection collection = stringValues; - - string[] tooSmall = new string[0]; - Assert.Throws(() => collection.CopyTo(tooSmall, 0)); - - string[] actual = new string[expected.Length]; - Assert.Throws(() => collection.CopyTo(actual, -1)); - Assert.Throws(() => collection.CopyTo(actual, actual.Length + 1)); - collection.CopyTo(actual, 0); - Assert.Equal(expected, actual); - } - - [Theory] - [MemberData(nameof(DefaultOrNullStringValues))] - [MemberData(nameof(EmptyStringValues))] - public void DefaultNullOrEmpty_Concat(StringValues stringValues) - { - string[] expected = new[] { "abc", "bcd", "foo" }; - Assert.Equal(expected, StringValues.Concat(stringValues, new StringValues(expected))); - Assert.Equal(expected, StringValues.Concat(new StringValues(expected), stringValues)); - - string[] empty = new string[0]; - Assert.Equal(empty, StringValues.Concat(stringValues, StringValues.Empty)); - Assert.Equal(empty, StringValues.Concat(StringValues.Empty, stringValues)); - Assert.Equal(empty, StringValues.Concat(stringValues, new StringValues())); - Assert.Equal(empty, StringValues.Concat(new StringValues(), stringValues)); - } - - [Theory] - [MemberData(nameof(FilledStringValuesWithExpected))] - public void Concat(StringValues stringValues, string[] array) - { - string[] filled = new[] { "abc", "bcd", "foo" }; - - string[] expectedPrepended = array.Concat(filled).ToArray(); - Assert.Equal(expectedPrepended, StringValues.Concat(stringValues, new StringValues(filled))); - - string[] expectedAppended = filled.Concat(array).ToArray(); - Assert.Equal(expectedAppended, StringValues.Concat(new StringValues(filled), stringValues)); - } - } -} diff --git a/test/Microsoft.Framework.Primitives.Tests/project.json b/test/Microsoft.Framework.Primitives.Tests/project.json deleted file mode 100644 index 1a5837820c..0000000000 --- a/test/Microsoft.Framework.Primitives.Tests/project.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "dependencies": { - "Microsoft.Framework.Primitives": "1.0.0-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" - }, - "commands": { - "test": "xunit.runner.aspnet" - }, - "frameworks": { - "dnx451": { }, - "dnxcore50": { } - } -}