|
| 1 | +using Microsoft.Extensions.DependencyInjection; |
| 2 | +using System; |
| 3 | +using System.Collections.Generic; |
| 4 | +using System.Linq; |
| 5 | +using System.Text; |
| 6 | +using System.Threading.Tasks; |
| 7 | +using Xunit; |
| 8 | + |
| 9 | +namespace AspectCore.Extensions.DependencyInjection.Test.Issues |
| 10 | +{ |
| 11 | + // https://github.com/dotnetcore/AspectCore-Framework/issues/305 |
| 12 | + public class ValueTupleMorethan7ElementsTests |
| 13 | + { |
| 14 | + [Fact] |
| 15 | + public void ValueTupleMorethan7Elements_Constructor_Test() |
| 16 | + { |
| 17 | + var services = new ServiceCollection(); |
| 18 | + services.AddScoped<ITestService, TestService>(); |
| 19 | + var serviceProvider = services.BuildServiceContextProvider(); |
| 20 | + var testService = serviceProvider.GetService<ITestService>(); |
| 21 | + Assert.NotNull(testService); |
| 22 | + |
| 23 | + var (a, b, c, d, e, f, g, h) = testService.Wrap(("a", "b", "c", "d", "e", "f", "g", "h")); |
| 24 | + Assert.Equal("a", a); |
| 25 | + Assert.Equal("b", b); |
| 26 | + Assert.Equal("c", c); |
| 27 | + Assert.Equal("d", d); |
| 28 | + Assert.Equal("e", e); |
| 29 | + Assert.Equal("f", f); |
| 30 | + Assert.Equal("g", g); |
| 31 | + Assert.Equal("h", h); |
| 32 | + } |
| 33 | + public interface ITestService |
| 34 | + { |
| 35 | + //void Update((string, string, string, string, string, string, string) tupleKey); |
| 36 | + void Update((string a, string b, string c, string d, string e, string f, string g, string h) tupleKey); |
| 37 | + (string a, string b, string c, string d, string e, string f, string g, string h) Wrap((string a, string b, string c, string d, string e, string f, string g, string h) tupleKey); |
| 38 | + //void Update2((string a, string b, string c, string d, string e, string f, string g) tupleKey); |
| 39 | + //void Update3((string a, string b, string c, string d, string e, string f, string g, string h, (string i, string j)) tupleKey); |
| 40 | + } |
| 41 | + |
| 42 | + public class TestService : ITestService |
| 43 | + { |
| 44 | + //public void Update((string, string, string, string, string, string, string) tupleKey) |
| 45 | + //{ |
| 46 | + |
| 47 | + //} |
| 48 | + public void Update((string a, string b, string c, string d, string e, string f, string g, string h) tupleKey) |
| 49 | + { |
| 50 | + } |
| 51 | + |
| 52 | + public (string a, string b, string c, string d, string e, string f, string g, string h) Wrap((string a, string b, string c, string d, string e, string f, string g, string h) tupleKey) |
| 53 | + { |
| 54 | + return tupleKey; |
| 55 | + } |
| 56 | + |
| 57 | + //public void Update2((string a, string b, string c, string d, string e, string f, string g) tupleKey) |
| 58 | + //{ |
| 59 | + |
| 60 | + //} |
| 61 | + |
| 62 | + //public void Update3((string a, string b, string c, string d, string e, string f, string g, string h, (string i, string j)) tupleKey) |
| 63 | + //{ |
| 64 | + |
| 65 | + //} |
| 66 | + |
| 67 | + //public void Update6((string a, string b, string c, string d, string e, string f, string g, (string h, string i, string j) ff) tupleKey) |
| 68 | + //{ |
| 69 | + |
| 70 | + //} |
| 71 | + |
| 72 | + //public void Update4((string, string, string, string, string, string, string) tupleKey) |
| 73 | + //{ |
| 74 | + |
| 75 | + //} |
| 76 | + |
| 77 | + //public void Update5((string, string, string, string, string, string, string, string, string) tupleKey) |
| 78 | + //{ |
| 79 | + |
| 80 | + //} |
| 81 | + } |
| 82 | + } |
| 83 | +} |
0 commit comments