|
1 | 1 | // Licensed to the .NET Foundation under one or more agreements.
|
2 | 2 | // The .NET Foundation licenses this file to you under the MIT license.
|
3 | 3 |
|
4 |
| -using System.Diagnostics.CodeAnalysis; |
5 | 4 | using System.Security.Claims;
|
6 | 5 | using Microsoft.AspNetCore.Authorization;
|
7 |
| -using Microsoft.AspNetCore.Components.Binding; |
8 | 6 | using Microsoft.AspNetCore.Components.Rendering;
|
9 | 7 | using Microsoft.AspNetCore.Components.RenderTree;
|
10 | 8 | using Microsoft.AspNetCore.Components.Test.Helpers;
|
@@ -67,26 +65,10 @@ public void WhenAuthorized_RendersPageInsideLayout()
|
67 | 65 | edit =>
|
68 | 66 | {
|
69 | 67 | Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type);
|
70 |
| - AssertFrame.Component<CascadingModelBinder>(batch.ReferenceFrames[edit.ReferenceFrameIndex]); |
| 68 | + AssertFrame.Component<TestPageRequiringAuthorization>(batch.ReferenceFrames[edit.ReferenceFrameIndex]); |
71 | 69 | },
|
72 | 70 | edit => AssertPrependText(batch, edit, "Layout ends here"));
|
73 | 71 |
|
74 |
| - var cascadingModelBinderDiff = batch.GetComponentDiffs<CascadingModelBinder>().Single(); |
75 |
| - Assert.Collection(cascadingModelBinderDiff.Edits, |
76 |
| - edit => |
77 |
| - { |
78 |
| - Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type); |
79 |
| - AssertFrame.Component<CascadingValue<ModelBindingContext>>(batch.ReferenceFrames[edit.ReferenceFrameIndex]); |
80 |
| - }); |
81 |
| - |
82 |
| - var cascadingValueDiff = batch.GetComponentDiffs<CascadingValue<ModelBindingContext>>().Single(); |
83 |
| - Assert.Collection(cascadingValueDiff.Edits, |
84 |
| - edit => |
85 |
| - { |
86 |
| - Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type); |
87 |
| - AssertFrame.Component<TestPageRequiringAuthorization>(batch.ReferenceFrames[edit.ReferenceFrameIndex]); |
88 |
| - }); |
89 |
| - |
90 | 72 | // Assert: renders page
|
91 | 73 | var pageDiff = batch.GetComponentDiffs<TestPageRequiringAuthorization>().Single();
|
92 | 74 | Assert.Collection(pageDiff.Edits,
|
@@ -120,26 +102,10 @@ public void AuthorizesWhenResourceIsSet()
|
120 | 102 | edit =>
|
121 | 103 | {
|
122 | 104 | Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type);
|
123 |
| - AssertFrame.Component<CascadingModelBinder>(batch.ReferenceFrames[edit.ReferenceFrameIndex]); |
| 105 | + AssertFrame.Component<TestPageRequiringAuthorization>(batch.ReferenceFrames[edit.ReferenceFrameIndex]); |
124 | 106 | },
|
125 | 107 | edit => AssertPrependText(batch, edit, "Layout ends here"));
|
126 | 108 |
|
127 |
| - var cascadingModelBinderDiff = batch.GetComponentDiffs<CascadingModelBinder>().Single(); |
128 |
| - Assert.Collection(cascadingModelBinderDiff.Edits, |
129 |
| - edit => |
130 |
| - { |
131 |
| - Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type); |
132 |
| - AssertFrame.Component<CascadingValue<ModelBindingContext>>(batch.ReferenceFrames[edit.ReferenceFrameIndex]); |
133 |
| - }); |
134 |
| - |
135 |
| - var cascadingValueDiff = batch.GetComponentDiffs<CascadingValue<ModelBindingContext>>().Single(); |
136 |
| - Assert.Collection(cascadingValueDiff.Edits, |
137 |
| - edit => |
138 |
| - { |
139 |
| - Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type); |
140 |
| - AssertFrame.Component<TestPageRequiringAuthorization>(batch.ReferenceFrames[edit.ReferenceFrameIndex]); |
141 |
| - }); |
142 |
| - |
143 | 109 | // Assert: renders page
|
144 | 110 | var pageDiff = batch.GetComponentDiffs<TestPageRequiringAuthorization>().Single();
|
145 | 111 | Assert.Collection(pageDiff.Edits,
|
@@ -327,8 +293,6 @@ public void WithoutCascadedAuthenticationState_WrapsOutputInCascadingAuthenticat
|
327 | 293 | component => Assert.IsType<CascadingValue<Task<AuthenticationState>>>(component),
|
328 | 294 | component => Assert.IsAssignableFrom<AuthorizeViewCore>(component),
|
329 | 295 | component => Assert.IsType<LayoutView>(component),
|
330 |
| - component => Assert.IsType<CascadingModelBinder>(component), |
331 |
| - component => Assert.IsType<CascadingValue<ModelBindingContext>>(component), |
332 | 296 | component => Assert.IsType<TestPageWithNoAuthorization>(component));
|
333 | 297 | }
|
334 | 298 |
|
@@ -360,8 +324,6 @@ public void WithCascadedAuthenticationState_DoesNotWrapOutputInCascadingAuthenti
|
360 | 324 | // further CascadingAuthenticationState
|
361 | 325 | component => Assert.IsAssignableFrom<AuthorizeViewCore>(component),
|
362 | 326 | component => Assert.IsType<LayoutView>(component),
|
363 |
| - component => Assert.IsType<CascadingModelBinder>(component), |
364 |
| - component => Assert.IsType<CascadingValue<ModelBindingContext>>(component), |
365 | 327 | component => Assert.IsType<TestPageWithNoAuthorization>(component));
|
366 | 328 | }
|
367 | 329 |
|
@@ -469,10 +431,4 @@ public TestNavigationManager()
|
469 | 431 | Initialize("https://localhost:85/subdir/", "https://localhost:85/subdir/path?query=value#hash");
|
470 | 432 | }
|
471 | 433 | }
|
472 |
| - |
473 |
| - private class TestFormValueSupplier : IFormValueSupplier |
474 |
| - { |
475 |
| - public bool CanBind(Type valueType, string formName = null) => false; |
476 |
| - public void Bind(FormValueSupplierContext context) { } |
477 |
| - } |
478 | 434 | }
|
0 commit comments