forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Porting changes from dotnet/extensions#536
- Loading branch information
Showing
16 changed files
with
634 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...rosoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/AbstractClass.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes | ||
{ | ||
public abstract class AbstractClass | ||
{ | ||
|
||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...ns.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassImplementingIComparable.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
|
||
namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes | ||
{ | ||
public class ClassImplementingIComparable : IComparable<ClassImplementingIComparable> | ||
{ | ||
public int CompareTo(ClassImplementingIComparable other) => 0; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...ns.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassImplementingIEnumerable.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Collections; | ||
|
||
namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes | ||
{ | ||
public class ClassImplementingIEnumerable : IEnumerable | ||
{ | ||
public IEnumerator GetEnumerator() => throw new NotImplementedException(); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...ns.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassInheritingAbstractClass.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes | ||
{ | ||
public class ClassInheritingAbstractClass : AbstractClass | ||
{ | ||
|
||
} | ||
|
||
public class ClassAlsoInheritingAbstractClass : AbstractClass | ||
{ | ||
|
||
} | ||
|
||
public class ClassInheritingClassInheritingAbstractClass : ClassInheritingAbstractClass | ||
{ | ||
|
||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...ependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithAbstractClassConstraint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes | ||
{ | ||
public class ClassWithAbstractClassConstraint<T> : IFakeOpenGenericService<T> | ||
where T : AbstractClass | ||
{ | ||
public ClassWithAbstractClassConstraint(T value) => Value = value; | ||
|
||
public T Value { get; } | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...nsions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithClassConstraint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes | ||
{ | ||
public class ClassWithClassConstraint<T> : IFakeOpenGenericService<T> | ||
where T : class | ||
{ | ||
public T Value { get; } = default; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...ns.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithInterfaceConstraint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Collections; | ||
|
||
namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes | ||
{ | ||
public class ClassWithInterfaceConstraint<T> : IFakeOpenGenericService<T> | ||
where T : IEnumerable | ||
{ | ||
public ClassWithInterfaceConstraint(T value) => Value = value; | ||
|
||
public T Value { get; } | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...tensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithNewConstraint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes | ||
{ | ||
public class ClassWithNewConstraint<T> : IFakeOpenGenericService<T> | ||
where T : new() | ||
{ | ||
public T Value { get; } = new T(); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...xtensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithNoConstraint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes | ||
{ | ||
public class ClassWithNoConstraints<T> : IFakeOpenGenericService<T> | ||
{ | ||
public T Value { get; } = default; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...endencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithSelfReferencingConstraint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
|
||
namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes | ||
{ | ||
public class ClassWithSelfReferencingConstraint<T> : IFakeOpenGenericService<T> | ||
where T : IComparable<T> | ||
{ | ||
public ClassWithSelfReferencingConstraint(T value) => Value = value; | ||
|
||
public T Value { get; } | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...sions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithStructConstraint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes | ||
{ | ||
public class ClassWithStructConstraint<T> : IFakeOpenGenericService<T> | ||
where T : struct | ||
{ | ||
public T Value { get; } = default; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...pendencyInjection/tests/DI.Specification.Tests/Fakes/ConstrainedFakeOpenGenericService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes | ||
{ | ||
public class ConstrainedFakeOpenGenericService<TVal> : IFakeOpenGenericService<TVal> | ||
where TVal : PocoClass | ||
{ | ||
public ConstrainedFakeOpenGenericService(TVal value) | ||
{ | ||
Value = value; | ||
} | ||
public TVal Value { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.