AuthSamples 274 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. commit 90eca80e0bb19d37dfe9791aeced8758b280ead4
  2. Author: Javier Calvarro Nelson <[email protected]>
  3. Date: Mon Mar 19 15:35:00 2018 -0700
  4. React to changes in MVC Testing
  5. diff --git a/samples/ClaimsTransformation/Program.cs b/samples/ClaimsTransformation/Program.cs
  6. index 91cd418a051..2e80b153155 100644
  7. --- a/samples/ClaimsTransformation/Program.cs
  8. +++ b/samples/ClaimsTransformation/Program.cs
  9. @@ -14,12 +14,13 @@ namespace AuthSamples.ClaimsTransformer
  10. {
  11. public static void Main(string[] args)
  12. {
  13. - BuildWebHost(args).Run();
  14. + CreateWebHostBuilder(args)
  15. + .Build()
  16. + .Run();
  17. }
  18. - public static IWebHost BuildWebHost(string[] args) =>
  19. + public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
  20. WebHost.CreateDefaultBuilder(args)
  21. - .UseStartup<Startup>()
  22. - .Build();
  23. + .UseStartup<Startup>();
  24. }
  25. }
  26. diff --git a/samples/Cookies/Program.cs b/samples/Cookies/Program.cs
  27. index 2bb34d98ceb..bea350e31d8 100644
  28. --- a/samples/Cookies/Program.cs
  29. +++ b/samples/Cookies/Program.cs
  30. @@ -14,12 +14,13 @@ namespace AuthSamples.Cookies
  31. {
  32. public static void Main(string[] args)
  33. {
  34. - BuildWebHost(args).Run();
  35. + CreateWebHostBuilder(args)
  36. + .Build()
  37. + .Run();
  38. }
  39. - public static IWebHost BuildWebHost(string[] args) =>
  40. + public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
  41. WebHost.CreateDefaultBuilder(args)
  42. - .UseStartup<Startup>()
  43. - .Build();
  44. + .UseStartup<Startup>();
  45. }
  46. }
  47. diff --git a/samples/DynamicSchemes/Program.cs b/samples/DynamicSchemes/Program.cs
  48. index ecb4c007741..1cc18672afe 100644
  49. --- a/samples/DynamicSchemes/Program.cs
  50. +++ b/samples/DynamicSchemes/Program.cs
  51. @@ -14,12 +14,13 @@ namespace AuthSamples.DynamicSchemes
  52. {
  53. public static void Main(string[] args)
  54. {
  55. - BuildWebHost(args).Run();
  56. + CreateWebHostBuilder(args)
  57. + .Build()
  58. + .Run();
  59. }
  60. - public static IWebHost BuildWebHost(string[] args) =>
  61. + public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
  62. WebHost.CreateDefaultBuilder(args)
  63. - .UseStartup<Startup>()
  64. - .Build();
  65. + .UseStartup<Startup>();
  66. }
  67. }
  68. diff --git a/samples/Identity.ExternalClaims/Program.cs b/samples/Identity.ExternalClaims/Program.cs
  69. index 37a3281287f..d65f6c66c33 100644
  70. --- a/samples/Identity.ExternalClaims/Program.cs
  71. +++ b/samples/Identity.ExternalClaims/Program.cs
  72. @@ -14,12 +14,11 @@ namespace Identity.ExternalClaims
  73. {
  74. public static void Main(string[] args)
  75. {
  76. - BuildWebHost(args).Run();
  77. + CreateWebHostBuilder(args).Build().Run();
  78. }
  79. - public static IWebHost BuildWebHost(string[] args) =>
  80. + public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
  81. WebHost.CreateDefaultBuilder(args)
  82. - .UseStartup<Startup>()
  83. - .Build();
  84. + .UseStartup<Startup>();
  85. }
  86. }
  87. diff --git a/samples/PathSchemeSelection/Program.cs b/samples/PathSchemeSelection/Program.cs
  88. index 424cb8c9bce..c5d428cc02e 100644
  89. --- a/samples/PathSchemeSelection/Program.cs
  90. +++ b/samples/PathSchemeSelection/Program.cs
  91. @@ -14,12 +14,11 @@ namespace AuthSamples.PathSchemeSelection
  92. {
  93. public static void Main(string[] args)
  94. {
  95. - BuildWebHost(args).Run();
  96. + CreateWebHostBuilder(args).Build().Run();
  97. }
  98. - public static IWebHost BuildWebHost(string[] args) =>
  99. + public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
  100. WebHost.CreateDefaultBuilder(args)
  101. - .UseStartup<Startup>()
  102. - .Build();
  103. + .UseStartup<Startup>();
  104. }
  105. }
  106. diff --git a/test/AuthSamples.FunctionalTests/ClaimsTransformTests.cs b/test/AuthSamples.FunctionalTests/ClaimsTransformTests.cs
  107. index 003360bdb2d..d402a2b56dc 100644
  108. --- a/test/AuthSamples.FunctionalTests/ClaimsTransformTests.cs
  109. +++ b/test/AuthSamples.FunctionalTests/ClaimsTransformTests.cs
  110. @@ -4,15 +4,16 @@
  111. using System.Net;
  112. using System.Net.Http;
  113. using System.Threading.Tasks;
  114. +using Microsoft.AspNetCore.Mvc.Testing;
  115. using Xunit;
  116. namespace AuthSamples.FunctionalTests
  117. {
  118. - public class ClaimsTransformTests : IClassFixture<SampleTestFixture<ClaimsTransformer.Startup>>
  119. + public class ClaimsTransformTests : IClassFixture<WebApplicationFactory<ClaimsTransformer.Startup>>
  120. {
  121. - public ClaimsTransformTests(SampleTestFixture<ClaimsTransformer.Startup> fixture)
  122. + public ClaimsTransformTests(WebApplicationFactory<ClaimsTransformer.Startup> fixture)
  123. {
  124. - Client = fixture.Client;
  125. + Client = fixture.CreateDefaultClient();
  126. }
  127. public HttpClient Client { get; }
  128. diff --git a/test/AuthSamples.FunctionalTests/CookiesTests.cs b/test/AuthSamples.FunctionalTests/CookiesTests.cs
  129. index 13cf85a0358..c8e9dd93a6f 100644
  130. --- a/test/AuthSamples.FunctionalTests/CookiesTests.cs
  131. +++ b/test/AuthSamples.FunctionalTests/CookiesTests.cs
  132. @@ -4,15 +4,16 @@
  133. using System.Net;
  134. using System.Net.Http;
  135. using System.Threading.Tasks;
  136. +using Microsoft.AspNetCore.Mvc.Testing;
  137. using Xunit;
  138. namespace AuthSamples.FunctionalTests
  139. {
  140. - public class CookiesTests : IClassFixture<SampleTestFixture<Cookies.Startup>>
  141. + public class CookiesTests : IClassFixture<WebApplicationFactory<Cookies.Startup>>
  142. {
  143. - public CookiesTests(SampleTestFixture<Cookies.Startup> fixture)
  144. + public CookiesTests(WebApplicationFactory<Cookies.Startup> fixture)
  145. {
  146. - Client = fixture.Client;
  147. + Client = fixture.CreateDefaultClient();
  148. }
  149. public HttpClient Client { get; }
  150. diff --git a/test/AuthSamples.FunctionalTests/DynamicSchemeTests.cs b/test/AuthSamples.FunctionalTests/DynamicSchemeTests.cs
  151. index c8925341268..6b36267df5a 100644
  152. --- a/test/AuthSamples.FunctionalTests/DynamicSchemeTests.cs
  153. +++ b/test/AuthSamples.FunctionalTests/DynamicSchemeTests.cs
  154. @@ -4,15 +4,16 @@
  155. using System.Net;
  156. using System.Net.Http;
  157. using System.Threading.Tasks;
  158. +using Microsoft.AspNetCore.Mvc.Testing;
  159. using Xunit;
  160. namespace AuthSamples.FunctionalTests
  161. {
  162. - public class DynamicSchemeTests : IClassFixture<SampleTestFixture<DynamicSchemes.Startup>>
  163. + public class DynamicSchemeTests : IClassFixture<WebApplicationFactory<DynamicSchemes.Startup>>
  164. {
  165. - public DynamicSchemeTests(SampleTestFixture<DynamicSchemes.Startup> fixture)
  166. + public DynamicSchemeTests(WebApplicationFactory<DynamicSchemes.Startup> fixture)
  167. {
  168. - Client = fixture.Client;
  169. + Client = fixture.CreateDefaultClient();
  170. }
  171. public HttpClient Client { get; }
  172. diff --git a/test/AuthSamples.FunctionalTests/IdentityExternalClaimsTests.cs b/test/AuthSamples.FunctionalTests/IdentityExternalClaimsTests.cs
  173. index ba99876a55d..e91874ac061 100644
  174. --- a/test/AuthSamples.FunctionalTests/IdentityExternalClaimsTests.cs
  175. +++ b/test/AuthSamples.FunctionalTests/IdentityExternalClaimsTests.cs
  176. @@ -4,15 +4,16 @@
  177. using System.Net;
  178. using System.Net.Http;
  179. using System.Threading.Tasks;
  180. +using Microsoft.AspNetCore.Mvc.Testing;
  181. using Xunit;
  182. namespace AuthSamples.FunctionalTests
  183. {
  184. - public class IdentityExternalClaimsTests : IClassFixture<SampleTestFixture<Identity.ExternalClaims.Startup>>
  185. + public class IdentityExternalClaimsTests : IClassFixture<WebApplicationFactory<Identity.ExternalClaims.Startup>>
  186. {
  187. - public IdentityExternalClaimsTests(SampleTestFixture<Identity.ExternalClaims.Startup> fixture)
  188. + public IdentityExternalClaimsTests(WebApplicationFactory<Identity.ExternalClaims.Startup> fixture)
  189. {
  190. - Client = fixture.Client;
  191. + Client = fixture.CreateDefaultClient();
  192. }
  193. public HttpClient Client { get; }
  194. diff --git a/test/AuthSamples.FunctionalTests/PathSchemeSelectionTests.cs b/test/AuthSamples.FunctionalTests/PathSchemeSelectionTests.cs
  195. index 7a9f64f5b8e..9a3246575e6 100644
  196. --- a/test/AuthSamples.FunctionalTests/PathSchemeSelectionTests.cs
  197. +++ b/test/AuthSamples.FunctionalTests/PathSchemeSelectionTests.cs
  198. @@ -4,15 +4,16 @@
  199. using System.Net;
  200. using System.Net.Http;
  201. using System.Threading.Tasks;
  202. +using Microsoft.AspNetCore.Mvc.Testing;
  203. using Xunit;
  204. namespace AuthSamples.FunctionalTests
  205. {
  206. - public class PathSchemeSelectionTests : IClassFixture<SampleTestFixture<PathSchemeSelection.Startup>>
  207. + public class PathSchemeSelectionTests : IClassFixture<WebApplicationFactory<PathSchemeSelection.Startup>>
  208. {
  209. - public PathSchemeSelectionTests(SampleTestFixture<PathSchemeSelection.Startup> fixture)
  210. + public PathSchemeSelectionTests(WebApplicationFactory<PathSchemeSelection.Startup> fixture)
  211. {
  212. - Client = fixture.Client;
  213. + Client = fixture.CreateDefaultClient();
  214. }
  215. public HttpClient Client { get; }
  216. diff --git a/test/AuthSamples.FunctionalTests/SampleTestFixture.cs b/test/AuthSamples.FunctionalTests/SampleTestFixture.cs
  217. deleted file mode 100644
  218. index 365c976e78d..00000000000
  219. --- a/test/AuthSamples.FunctionalTests/SampleTestFixture.cs
  220. +++ /dev/null
  221. @@ -1,13 +0,0 @@
  222. -// Copyright (c) .NET Foundation. All rights reserved.
  223. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
  224. -
  225. -using System.IO;
  226. -using Microsoft.AspNetCore.Mvc.Testing;
  227. -
  228. -namespace AuthSamples.FunctionalTests
  229. -{
  230. - public class SampleTestFixture<TStartup> : WebApplicationTestFixture<TStartup> where TStartup : class
  231. - {
  232. - public SampleTestFixture() : base(Path.Combine("samples", typeof(TStartup).Assembly.GetName().Name)) { }
  233. - }
  234. -}
  235. diff --git a/test/AuthSamples.FunctionalTests/xunit.runner.json b/test/AuthSamples.FunctionalTests/xunit.runner.json
  236. new file mode 100644
  237. index 00000000000..42db7ef95e9
  238. --- /dev/null
  239. +++ b/test/AuthSamples.FunctionalTests/xunit.runner.json
  240. @@ -0,0 +1,3 @@
  241. +{
  242. + "shadowCopy": false
  243. +}