Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
Prism
提交
6a09b9ba
P
Prism
项目概览
jobily
/
Prism
8 个月 前同步成功
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Prism
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
6a09b9ba
编写于
8月 26, 2023
作者:
D
Dan Siegel
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: updating tests for namespace & type name breaks
上级
01ec1ef8
变更
32
展开全部
隐藏空白更改
内联
并排
Showing
32 changed file
with
294 addition
and
275 deletion
+294
-275
src/Forms/Prism.Forms.Regions/Regions/Adapters/IRegionAdapter.cs
...ms/Prism.Forms.Regions/Regions/Adapters/IRegionAdapter.cs
+0
-18
src/Forms/Prism.Forms.Regions/Regions/Adapters/RegionAdapterBase.cs
...Prism.Forms.Regions/Regions/Adapters/RegionAdapterBase.cs
+1
-1
tests/Forms/Prism.DI.Forms.Tests/Fixtures/Regions/RegionFixture.cs
...ms/Prism.DI.Forms.Tests/Fixtures/Regions/RegionFixture.cs
+1
-1
tests/Forms/Prism.DI.Forms.Tests/Mocks/ViewModels/Issue2415PageViewModel.cs
...DI.Forms.Tests/Mocks/ViewModels/Issue2415PageViewModel.cs
+2
-2
tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockPresentationRegion.cs
...Prism.Forms.Regions.Tests/Mocks/MockPresentationRegion.cs
+14
-9
tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegion.cs
tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegion.cs
+11
-11
tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionAdapter.cs
...orms/Prism.Forms.Regions.Tests/Mocks/MockRegionAdapter.cs
+4
-3
tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionBehaviorCollection.cs
...Forms.Regions.Tests/Mocks/MockRegionBehaviorCollection.cs
+1
-1
tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockViewsCollection.cs
...ms/Prism.Forms.Regions.Tests/Mocks/MockViewsCollection.cs
+4
-4
tests/Forms/Prism.Forms.Regions.Tests/Tests/LocatorNavigationTargetHandlerFixture.cs
...ions.Tests/Tests/LocatorNavigationTargetHandlerFixture.cs
+4
-4
tests/Forms/Prism.Forms.Regions.Tests/Tests/NavigationAsyncExtensionsFixture.cs
...s.Regions.Tests/Tests/NavigationAsyncExtensionsFixture.cs
+5
-4
tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorCollectionFixture.cs
...ms.Regions.Tests/Tests/RegionBehaviorCollectionFixture.cs
+1
-1
tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFactoryFixture.cs
...Forms.Regions.Tests/Tests/RegionBehaviorFactoryFixture.cs
+1
-1
tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFixture.cs
.../Prism.Forms.Regions.Tests/Tests/RegionBehaviorFixture.cs
+1
-0
tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionFixture.cs
tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionFixture.cs
+1
-1
tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerFixture.cs
...s/Prism.Forms.Regions.Tests/Tests/RegionManagerFixture.cs
+8
-3
tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerRequestNavigateFixture.cs
...egions.Tests/Tests/RegionManagerRequestNavigateFixture.cs
+10
-10
tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationJournalFixture.cs
...rms.Regions.Tests/Tests/RegionNavigationJournalFixture.cs
+73
-72
tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationServiceFixture.cs
...rms.Regions.Tests/Tests/RegionNavigationServiceFixture.cs
+87
-86
tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionViewRegistryFixture.cs
...sm.Forms.Regions.Tests/Tests/RegionViewRegistryFixture.cs
+1
-1
tests/Maui/Prism.DryIoc.Maui.Tests/Fixtures/Regions/RegionFixture.cs
...Prism.DryIoc.Maui.Tests/Fixtures/Regions/RegionFixture.cs
+2
-1
tests/Maui/Prism.DryIoc.Maui.Tests/Mocks/ViewModels/MockRegionViewAViewModel.cs
...c.Maui.Tests/Mocks/ViewModels/MockRegionViewAViewModel.cs
+3
-3
tests/Wpf/Prism.IocContainer.Wpf.Tests.Support/Mocks/MockRegionManager.cs
...IocContainer.Wpf.Tests.Support/Mocks/MockRegionManager.cs
+6
-0
tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionManager.cs
tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionManager.cs
+2
-1
tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/AutoPopulateRegionBehaviorFixture.cs
...ts/Regions/Behaviors/AutoPopulateRegionBehaviorFixture.cs
+9
-3
tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/RegionManagerRegistrationBehaviorFixture.cs
...ons/Behaviors/RegionManagerRegistrationBehaviorFixture.cs
+2
-1
tests/Wpf/Prism.Wpf.Tests/Regions/NavigationAsyncExtensionsFixture.cs
...ism.Wpf.Tests/Regions/NavigationAsyncExtensionsFixture.cs
+1
-0
tests/Wpf/Prism.Wpf.Tests/Regions/RegionFixture.cs
tests/Wpf/Prism.Wpf.Tests/Regions/RegionFixture.cs
+1
-1
tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerFixture.cs
tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerFixture.cs
+10
-5
tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerRequestNavigateFixture.cs
....Wpf.Tests/Regions/RegionManagerRequestNavigateFixture.cs
+4
-4
tests/Wpf/Prism.Wpf.Tests/Regions/RegionNavigationServiceFixture.new.cs
...m.Wpf.Tests/Regions/RegionNavigationServiceFixture.new.cs
+23
-22
tests/Wpf/Prism.Wpf.Tests/Regions/RegionViewRegistryFixture.cs
.../Wpf/Prism.Wpf.Tests/Regions/RegionViewRegistryFixture.cs
+1
-1
未找到文件。
src/Forms/Prism.Forms.Regions/Regions/Adapters/IRegionAdapter.cs
已删除
100644 → 0
浏览文件 @
01ec1ef8
using
Xamarin.Forms
;
namespace
Prism.Regions.Adapters
{
/// <summary>
/// Defines an interfaces to adapt an object and bind it to a new <see cref="IRegion"/>.
/// </summary>
public
interface
IRegionAdapter
{
/// <summary>
/// Adapts an object and binds it to a new <see cref="IRegion"/>.
/// </summary>
/// <param name="regionTarget">The object to adapt.</param>
/// <param name="regionName">The name of the region to be created.</param>
/// <returns>The new instance of <see cref="IRegion"/> that the <paramref name="regionTarget"/> is bound to.</returns>
IRegion
Initialize
(
VisualElement
regionTarget
,
string
regionName
);
}
}
src/Forms/Prism.Forms.Regions/Regions/Adapters/RegionAdapterBase.cs
浏览文件 @
6a09b9ba
...
@@ -55,7 +55,7 @@ namespace Prism.Regions.Adapters
...
@@ -55,7 +55,7 @@ namespace Prism.Regions.Adapters
/// is of type <typeparamref name="T"/>.</remarks>
/// is of type <typeparamref name="T"/>.</remarks>
/// <exception cref="ArgumentNullException">When <paramref name="regionTarget"/> is <see langword="null" />.</exception>
/// <exception cref="ArgumentNullException">When <paramref name="regionTarget"/> is <see langword="null" />.</exception>
/// <exception cref="InvalidOperationException">When <paramref name="regionTarget"/> is not of type <typeparamref name="T"/>.</exception>
/// <exception cref="InvalidOperationException">When <paramref name="regionTarget"/> is not of type <typeparamref name="T"/>.</exception>
IRegion
IRegionAdapter
.
Initialize
(
VisualElemen
t
regionTarget
,
string
regionName
)
IRegion
IRegionAdapter
.
Initialize
(
objec
t
regionTarget
,
string
regionName
)
{
{
return
Initialize
(
GetCastedObject
(
regionTarget
),
regionName
);
return
Initialize
(
GetCastedObject
(
regionTarget
),
regionName
);
}
}
...
...
tests/Forms/Prism.DI.Forms.Tests/Fixtures/Regions/RegionFixture.cs
浏览文件 @
6a09b9ba
...
@@ -31,7 +31,7 @@ namespace Prism.DI.Forms.Tests.Fixtures.Regions
...
@@ -31,7 +31,7 @@ namespace Prism.DI.Forms.Tests.Fixtures.Regions
var
vm
=
_app
.
MainPage
.
BindingContext
as
Issue2415PageViewModel
;
var
vm
=
_app
.
MainPage
.
BindingContext
as
Issue2415PageViewModel
;
Assert
.
NotNull
(
vm
.
Result
);
Assert
.
NotNull
(
vm
.
Result
);
Assert
.
True
(
vm
.
Result
.
Result
);
Assert
.
True
(
vm
.
Result
.
Success
);
}
}
void
IPlatformInitializer
.
RegisterTypes
(
IContainerRegistry
containerRegistry
)
void
IPlatformInitializer
.
RegisterTypes
(
IContainerRegistry
containerRegistry
)
...
...
tests/Forms/Prism.DI.Forms.Tests/Mocks/ViewModels/Issue2415PageViewModel.cs
浏览文件 @
6a09b9ba
...
@@ -18,14 +18,14 @@ namespace Prism.DI.Forms.Tests.Mocks.ViewModels
...
@@ -18,14 +18,14 @@ namespace Prism.DI.Forms.Tests.Mocks.ViewModels
_regionManager
=
regionManager
;
_regionManager
=
regionManager
;
}
}
public
IRegion
NavigationResult
Result
{
get
;
private
set
;
}
public
NavigationResult
Result
{
get
;
private
set
;
}
public
void
Initialize
(
INavigationParameters
parameters
)
public
void
Initialize
(
INavigationParameters
parameters
)
{
{
_regionManager
.
RequestNavigate
(
"ContentRegion"
,
"Issue2415RegionView"
,
NavigationCallback
);
_regionManager
.
RequestNavigate
(
"ContentRegion"
,
"Issue2415RegionView"
,
NavigationCallback
);
}
}
private
void
NavigationCallback
(
IRegion
NavigationResult
result
)
private
void
NavigationCallback
(
NavigationResult
result
)
{
{
Result
=
result
;
Result
=
result
;
}
}
...
...
tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockPresentationRegion.cs
浏览文件 @
6a09b9ba
...
@@ -17,35 +17,35 @@ namespace Prism.Forms.Regions.Mocks
...
@@ -17,35 +17,35 @@ namespace Prism.Forms.Regions.Mocks
{
{
Behaviors
=
new
MockRegionBehaviorCollection
();
Behaviors
=
new
MockRegionBehaviorCollection
();
}
}
public
IRegionManager
Add
(
VisualElemen
t
view
)
public
IRegionManager
Add
(
objec
t
view
)
{
{
MockViews
.
Items
.
Add
(
view
);
MockViews
.
Items
.
Add
(
view
);
return
null
;
return
null
;
}
}
public
void
Remove
(
VisualElemen
t
view
)
public
void
Remove
(
objec
t
view
)
{
{
MockViews
.
Items
.
Remove
(
view
);
MockViews
.
Items
.
Remove
(
view
);
MockActiveViews
.
Items
.
Remove
(
view
);
MockActiveViews
.
Items
.
Remove
(
view
);
}
}
public
void
Activate
(
VisualElemen
t
view
)
public
void
Activate
(
objec
t
view
)
{
{
MockActiveViews
.
Items
.
Add
(
view
);
MockActiveViews
.
Items
.
Add
(
view
);
}
}
public
IRegionManager
Add
(
VisualElemen
t
view
,
string
viewName
)
public
IRegionManager
Add
(
objec
t
view
,
string
viewName
)
{
{
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
public
IRegionManager
Add
(
VisualElemen
t
view
,
string
viewName
,
bool
createRegionManagerScope
)
public
IRegionManager
Add
(
objec
t
view
,
string
viewName
,
bool
createRegionManagerScope
)
{
{
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
public
VisualElemen
t
GetView
(
string
viewName
)
public
objec
t
GetView
(
string
viewName
)
{
{
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
...
@@ -103,12 +103,12 @@ namespace Prism.Forms.Regions.Mocks
...
@@ -103,12 +103,12 @@ namespace Prism.Forms.Regions.Mocks
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
public
void
RequestNavigate
(
Uri
target
,
Action
<
IRegion
NavigationResult
>
navigationCallback
)
public
void
RequestNavigate
(
Uri
target
,
Action
<
NavigationResult
>
navigationCallback
)
{
{
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
public
void
RequestNavigate
(
Uri
target
,
Action
<
IRegion
NavigationResult
>
navigationCallback
,
INavigationParameters
navigationParameters
)
public
void
RequestNavigate
(
Uri
target
,
Action
<
NavigationResult
>
navigationCallback
,
INavigationParameters
navigationParameters
)
{
{
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
...
@@ -118,6 +118,11 @@ namespace Prism.Forms.Regions.Mocks
...
@@ -118,6 +118,11 @@ namespace Prism.Forms.Regions.Mocks
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
public
void
Deactivate
(
object
view
)
{
throw
new
NotImplementedException
();
}
public
IRegionNavigationService
NavigationService
public
IRegionNavigationService
NavigationService
{
{
get
=>
throw
new
NotImplementedException
();
get
=>
throw
new
NotImplementedException
();
...
@@ -125,7 +130,7 @@ namespace Prism.Forms.Regions.Mocks
...
@@ -125,7 +130,7 @@ namespace Prism.Forms.Regions.Mocks
}
}
public
Comparison
<
VisualElemen
t
>
SortComparison
public
Comparison
<
objec
t
>
SortComparison
{
{
get
=>
throw
new
NotImplementedException
();
get
=>
throw
new
NotImplementedException
();
set
=>
throw
new
NotImplementedException
();
set
=>
throw
new
NotImplementedException
();
...
...
tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegion.cs
浏览文件 @
6a09b9ba
...
@@ -11,7 +11,7 @@ namespace Prism.Forms.Regions.Mocks
...
@@ -11,7 +11,7 @@ namespace Prism.Forms.Regions.Mocks
internal
class
MockRegion
:
IRegion
internal
class
MockRegion
:
IRegion
{
{
public
event
PropertyChangedEventHandler
PropertyChanged
;
public
event
PropertyChangedEventHandler
PropertyChanged
;
public
Func
<
string
,
VisualElemen
t
>
GetViewStringDelegate
{
get
;
set
;
}
public
Func
<
string
,
objec
t
>
GetViewStringDelegate
{
get
;
set
;
}
private
MockViewsCollection
_views
=
new
MockViewsCollection
();
private
MockViewsCollection
_views
=
new
MockViewsCollection
();
...
@@ -33,38 +33,38 @@ namespace Prism.Forms.Regions.Mocks
...
@@ -33,38 +33,38 @@ namespace Prism.Forms.Regions.Mocks
public
string
Name
{
get
;
set
;
}
public
string
Name
{
get
;
set
;
}
public
IRegionManager
Add
(
VisualElemen
t
view
)
public
IRegionManager
Add
(
objec
t
view
)
{
{
_views
.
Add
(
view
);
_views
.
Add
(
view
);
return
null
;
return
null
;
}
}
public
IRegionManager
Add
(
VisualElemen
t
view
,
string
viewName
)
public
IRegionManager
Add
(
objec
t
view
,
string
viewName
)
{
{
return
Add
(
view
);
return
Add
(
view
);
}
}
public
IRegionManager
Add
(
VisualElemen
t
view
,
string
viewName
,
bool
createRegionManagerScope
)
public
IRegionManager
Add
(
objec
t
view
,
string
viewName
,
bool
createRegionManagerScope
)
{
{
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
public
void
Remove
(
VisualElemen
t
view
)
public
void
Remove
(
objec
t
view
)
{
{
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
public
void
Activate
(
VisualElemen
t
view
)
public
void
Activate
(
objec
t
view
)
{
{
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
public
void
Deactivate
(
VisualElemen
t
view
)
public
void
Deactivate
(
objec
t
view
)
{
{
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
public
VisualElemen
t
GetView
(
string
viewName
)
public
objec
t
GetView
(
string
viewName
)
{
{
return
GetViewStringDelegate
(
viewName
);
return
GetViewStringDelegate
(
viewName
);
}
}
...
@@ -82,12 +82,12 @@ namespace Prism.Forms.Regions.Mocks
...
@@ -82,12 +82,12 @@ namespace Prism.Forms.Regions.Mocks
}
}
public
void
RequestNavigate
(
Uri
target
,
Action
<
IRegion
NavigationResult
>
navigationCallback
)
public
void
RequestNavigate
(
Uri
target
,
Action
<
NavigationResult
>
navigationCallback
)
{
{
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
public
void
RequestNavigate
(
Uri
target
,
Action
<
IRegion
NavigationResult
>
navigationCallback
,
INavigationParameters
navigationParameters
)
public
void
RequestNavigate
(
Uri
target
,
Action
<
NavigationResult
>
navigationCallback
,
INavigationParameters
navigationParameters
)
{
{
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
...
@@ -104,7 +104,7 @@ namespace Prism.Forms.Regions.Mocks
...
@@ -104,7 +104,7 @@ namespace Prism.Forms.Regions.Mocks
}
}
public
Comparison
<
VisualElemen
t
>
SortComparison
public
Comparison
<
objec
t
>
SortComparison
{
{
get
=>
throw
new
NotImplementedException
();
get
=>
throw
new
NotImplementedException
();
set
=>
throw
new
NotImplementedException
();
set
=>
throw
new
NotImplementedException
();
...
...
tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionAdapter.cs
浏览文件 @
6a09b9ba
...
@@ -11,14 +11,15 @@ namespace Prism.Forms.Regions.Mocks
...
@@ -11,14 +11,15 @@ namespace Prism.Forms.Regions.Mocks
public
MockRegionManagerAccessor
Accessor
;
public
MockRegionManagerAccessor
Accessor
;
public
IRegion
Initialize
(
VisualElemen
t
regionTarget
,
string
regionName
)
public
IRegion
Initialize
(
objec
t
regionTarget
,
string
regionName
)
{
{
CreatedRegions
.
Add
(
regionName
);
CreatedRegions
.
Add
(
regionName
);
var
region
=
new
MockPresentationRegion
();
var
region
=
new
MockPresentationRegion
();
Prism
.
Regions
.
Xaml
.
RegionManager
.
GetObservableRegion
(
regionTarget
).
Value
=
region
;
if
(
regionTarget
is
VisualElement
element
)
Prism
.
Regions
.
Xaml
.
RegionManager
.
GetObservableRegion
(
element
).
Value
=
region
;
// Fire update regions again. This also happens if a region is created and added to the
regionm
anager
// Fire update regions again. This also happens if a region is created and added to the
RegionM
anager
if
(
Accessor
!=
null
)
if
(
Accessor
!=
null
)
Accessor
.
UpdateRegions
();
Accessor
.
UpdateRegions
();
...
...
tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionBehaviorCollection.cs
浏览文件 @
6a09b9ba
using
System.Collections
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
Prism.Regions
.Behaviors
;
using
Prism.Regions
;
namespace
Prism.Forms.Regions.Mocks
namespace
Prism.Forms.Regions.Mocks
{
{
...
...
tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockViewsCollection.cs
浏览文件 @
6a09b9ba
...
@@ -9,19 +9,19 @@ namespace Prism.Forms.Regions.Mocks
...
@@ -9,19 +9,19 @@ namespace Prism.Forms.Regions.Mocks
{
{
internal
class
MockViewsCollection
:
IViewsCollection
internal
class
MockViewsCollection
:
IViewsCollection
{
{
public
ObservableCollection
<
VisualElement
>
Items
=
new
ObservableCollection
<
VisualElemen
t
>();
public
ObservableCollection
<
object
>
Items
=
new
ObservableCollection
<
objec
t
>();
public
void
Add
(
VisualElemen
t
view
)
public
void
Add
(
objec
t
view
)
{
{
Items
.
Add
(
view
);
Items
.
Add
(
view
);
}
}
public
bool
Contains
(
VisualElemen
t
value
)
public
bool
Contains
(
objec
t
value
)
{
{
return
Items
.
Contains
(
value
);
return
Items
.
Contains
(
value
);
}
}
public
IEnumerator
<
VisualElemen
t
>
GetEnumerator
()
public
IEnumerator
<
objec
t
>
GetEnumerator
()
{
{
return
Items
.
GetEnumerator
();
return
Items
.
GetEnumerator
();
}
}
...
...
tests/Forms/Prism.Forms.Regions.Tests/Tests/LocatorNavigationTargetHandlerFixture.cs
浏览文件 @
6a09b9ba
...
@@ -124,7 +124,7 @@ namespace Prism.Forms.Regions.Tests
...
@@ -124,7 +124,7 @@ namespace Prism.Forms.Regions.Tests
var
viewMock
=
new
Mock
<
View
>();
var
viewMock
=
new
Mock
<
View
>();
viewMock
viewMock
.
As
<
IRegionAware
>()
.
As
<
IRegionAware
>()
.
Setup
(
v
=>
v
.
IsNavigationTarget
(
It
.
IsAny
<
I
NavigationContext
>()))
.
Setup
(
v
=>
v
.
IsNavigationTarget
(
It
.
IsAny
<
NavigationContext
>()))
.
Returns
(
true
)
.
Returns
(
true
)
.
Verifiable
();
.
Verifiable
();
...
@@ -157,7 +157,7 @@ namespace Prism.Forms.Regions.Tests
...
@@ -157,7 +157,7 @@ namespace Prism.Forms.Regions.Tests
var
bindingContextMock
=
new
Mock
<
IRegionAware
>();
var
bindingContextMock
=
new
Mock
<
IRegionAware
>();
bindingContextMock
bindingContextMock
.
Setup
(
v
=>
v
.
IsNavigationTarget
(
It
.
IsAny
<
I
NavigationContext
>()))
.
Setup
(
v
=>
v
.
IsNavigationTarget
(
It
.
IsAny
<
NavigationContext
>()))
.
Returns
(
true
)
.
Returns
(
true
)
.
Verifiable
();
.
Verifiable
();
var
viewMock
=
new
Mock
<
View
>();
var
viewMock
=
new
Mock
<
View
>();
...
@@ -226,7 +226,7 @@ namespace Prism.Forms.Regions.Tests
...
@@ -226,7 +226,7 @@ namespace Prism.Forms.Regions.Tests
var
viewMock
=
new
Mock
<
View
>();
var
viewMock
=
new
Mock
<
View
>();
viewMock
viewMock
.
As
<
IRegionAware
>()
.
As
<
IRegionAware
>()
.
Setup
(
v
=>
v
.
IsNavigationTarget
(
It
.
IsAny
<
I
NavigationContext
>()))
.
Setup
(
v
=>
v
.
IsNavigationTarget
(
It
.
IsAny
<
NavigationContext
>()))
.
Returns
(
false
)
.
Returns
(
false
)
.
Verifiable
();
.
Verifiable
();
...
@@ -265,7 +265,7 @@ namespace Prism.Forms.Regions.Tests
...
@@ -265,7 +265,7 @@ namespace Prism.Forms.Regions.Tests
var
bindingContextMock
=
new
Mock
<
IRegionAware
>();
var
bindingContextMock
=
new
Mock
<
IRegionAware
>();
bindingContextMock
bindingContextMock
.
Setup
(
v
=>
v
.
IsNavigationTarget
(
It
.
IsAny
<
I
NavigationContext
>()))
.
Setup
(
v
=>
v
.
IsNavigationTarget
(
It
.
IsAny
<
NavigationContext
>()))
.
Returns
(
false
)
.
Returns
(
false
)
.
Verifiable
();
.
Verifiable
();
var
viewMock
=
new
Mock
<
View
>();
var
viewMock
=
new
Mock
<
View
>();
...
...
tests/Forms/Prism.Forms.Regions.Tests/Tests/NavigationAsyncExtensionsFixture.cs
浏览文件 @
6a09b9ba
...
@@ -2,7 +2,8 @@
...
@@ -2,7 +2,8 @@
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Text
;
using
Moq
;
using
Moq
;
using
Prism.Regions.Navigation
;
using
Prism.Navigation
;
using
Prism.Regions
;
using
Xunit
;
using
Xunit
;
namespace
Prism.Forms.Regions.Tests
namespace
Prism.Forms.Regions.Tests
...
@@ -43,7 +44,7 @@ namespace Prism.Forms.Regions.Tests
...
@@ -43,7 +44,7 @@ namespace Prism.Forms.Regions.Tests
.
Setup
(
nv
=>
.
Setup
(
nv
=>
nv
.
RequestNavigate
(
nv
.
RequestNavigate
(
It
.
Is
<
Uri
>(
u
=>
!
u
.
IsAbsoluteUri
&&
u
.
OriginalString
==
"relative"
),
It
.
Is
<
Uri
>(
u
=>
!
u
.
IsAbsoluteUri
&&
u
.
OriginalString
==
"relative"
),
It
.
Is
<
Action
<
IRegion
NavigationResult
>>(
c
=>
c
!=
null
)))
It
.
Is
<
Action
<
NavigationResult
>>(
c
=>
c
!=
null
)))
.
Verifiable
();
.
Verifiable
();
string
target
=
"relative"
;
string
target
=
"relative"
;
...
@@ -61,7 +62,7 @@ namespace Prism.Forms.Regions.Tests
...
@@ -61,7 +62,7 @@ namespace Prism.Forms.Regions.Tests
.
Setup
(
nv
=>
.
Setup
(
nv
=>
nv
.
RequestNavigate
(
nv
.
RequestNavigate
(
It
.
Is
<
Uri
>(
u
=>
u
.
IsAbsoluteUri
&&
u
.
Host
==
"test"
&&
u
.
AbsolutePath
==
"/path"
),
It
.
Is
<
Uri
>(
u
=>
u
.
IsAbsoluteUri
&&
u
.
Host
==
"test"
&&
u
.
AbsolutePath
==
"/path"
),
It
.
Is
<
Action
<
IRegion
NavigationResult
>>(
c
=>
c
!=
null
)))
It
.
Is
<
Action
<
NavigationResult
>>(
c
=>
c
!=
null
)))
.
Verifiable
();
.
Verifiable
();
string
target
=
"http://test/path"
;
string
target
=
"http://test/path"
;
...
@@ -94,7 +95,7 @@ namespace Prism.Forms.Regions.Tests
...
@@ -94,7 +95,7 @@ namespace Prism.Forms.Regions.Tests
.
Setup
(
nv
=>
.
Setup
(
nv
=>
nv
.
RequestNavigate
(
nv
.
RequestNavigate
(
target
,
target
,
It
.
Is
<
Action
<
IRegion
NavigationResult
>>(
c
=>
c
!=
null
)))
It
.
Is
<
Action
<
NavigationResult
>>(
c
=>
c
!=
null
)))
.
Verifiable
();
.
Verifiable
();
...
...
tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorCollectionFixture.cs
浏览文件 @
6a09b9ba
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Text
;
using
Prism.Forms.Regions.Mocks
;
using
Prism.Forms.Regions.Mocks
;
using
Prism.Regions
.Behaviors
;
using
Prism.Regions
;
using
Xunit
;
using
Xunit
;
namespace
Prism.Forms.Regions.Tests
namespace
Prism.Forms.Regions.Tests
...
...
tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFactoryFixture.cs
浏览文件 @
6a09b9ba
...
@@ -4,7 +4,7 @@ using System.Linq;
...
@@ -4,7 +4,7 @@ using System.Linq;
using
Moq
;
using
Moq
;
using
Prism.Forms.Regions.Mocks
;
using
Prism.Forms.Regions.Mocks
;
using
Prism.Ioc
;
using
Prism.Ioc
;
using
Prism.Regions
.Behaviors
;
using
Prism.Regions
;
using
Xunit
;
using
Xunit
;
namespace
Prism.Forms.Regions.Tests
namespace
Prism.Forms.Regions.Tests
...
...
tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFixture.cs
浏览文件 @
6a09b9ba
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Text
;
using
Prism.Forms.Regions.Mocks
;
using
Prism.Forms.Regions.Mocks
;
using
Prism.Regions
;
using
Prism.Regions.Behaviors
;
using
Prism.Regions.Behaviors
;
using
Xunit
;
using
Xunit
;
...
...
tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionFixture.cs
浏览文件 @
6a09b9ba
...
@@ -484,7 +484,7 @@ namespace Prism.Forms.Regions.Tests
...
@@ -484,7 +484,7 @@ namespace Prism.Forms.Regions.Tests
region
.
Add
(
view
);
region
.
Add
(
view
);
var
uri
=
new
Uri
(
view
.
GetType
().
Name
,
UriKind
.
Relative
);
var
uri
=
new
Uri
(
view
.
GetType
().
Name
,
UriKind
.
Relative
);
Action
<
IRegion
NavigationResult
>
navigationCallback
=
nr
=>
{
};
Action
<
NavigationResult
>
navigationCallback
=
nr
=>
{
};
var
navigationParameters
=
new
NavigationParameters
();
var
navigationParameters
=
new
NavigationParameters
();
var
mockRegionNavigationService
=
new
Mock
<
IRegionNavigationService
>();
var
mockRegionNavigationService
=
new
Mock
<
IRegionNavigationService
>();
...
...
tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerFixture.cs
浏览文件 @
6a09b9ba
...
@@ -479,19 +479,24 @@ namespace Prism.Forms.Regions.Tests
...
@@ -479,19 +479,24 @@ namespace Prism.Forms.Regions.Tests
internal
class
MockRegionContentRegistry
:
IRegionViewRegistry
internal
class
MockRegionContentRegistry
:
IRegionViewRegistry
{
{
public
Func
<
string
,
Type
,
object
>
RegisterContentWithViewType
;
public
Func
<
string
,
Type
,
object
>
RegisterContentWithViewType
;
public
Func
<
string
,
Func
<
object
>,
object
>
RegisterContentWithDelegate
;
public
Func
<
string
,
Func
<
IContainerProvider
,
object
>,
object
>
RegisterContentWithDelegate
;
public
event
EventHandler
<
ViewRegisteredEventArgs
>
ContentRegistered
;
public
event
EventHandler
<
ViewRegisteredEventArgs
>
ContentRegistered
;
public
IEnumerable
<
object
>
GetContents
(
string
regionName
)
public
IEnumerable
<
object
>
GetContents
(
string
regionName
,
IContainerProvider
container
)
{
{
return
null
;
return
null
;
}
}
public
void
RegisterViewWithRegion
(
string
regionName
,
string
targetName
)
{
throw
new
NotImplementedException
();
}
void
IRegionViewRegistry
.
RegisterViewWithRegion
(
string
regionName
,
Type
viewType
)
void
IRegionViewRegistry
.
RegisterViewWithRegion
(
string
regionName
,
Type
viewType
)
{
{
RegisterContentWithViewType
?.
Invoke
(
regionName
,
viewType
);
RegisterContentWithViewType
?.
Invoke
(
regionName
,
viewType
);
}
}
void
IRegionViewRegistry
.
RegisterViewWithRegion
(
string
regionName
,
Func
<
object
>
getContentDelegate
)
void
IRegionViewRegistry
.
RegisterViewWithRegion
(
string
regionName
,
Func
<
IContainerProvider
,
object
>
getContentDelegate
)
{
{
RegisterContentWithDelegate
?.
Invoke
(
regionName
,
getContentDelegate
);
RegisterContentWithDelegate
?.
Invoke
(
regionName
,
getContentDelegate
);
...
...
tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerRequestNavigateFixture.cs
浏览文件 @
6a09b9ba
...
@@ -17,7 +17,7 @@ namespace Prism.Forms.Regions.Tests
...
@@ -17,7 +17,7 @@ namespace Prism.Forms.Regions.Tests
private
static
Uri
sourceUri
=
new
Uri
(
source
,
UriKind
.
RelativeOrAbsolute
);
private
static
Uri
sourceUri
=
new
Uri
(
source
,
UriKind
.
RelativeOrAbsolute
);
private
static
INavigationParameters
parameters
=
new
NavigationParameters
();
private
static
INavigationParameters
parameters
=
new
NavigationParameters
();
private
static
Action
<
IRegion
NavigationResult
>
callback
=
(
_
)
=>
{
};
private
static
Action
<
NavigationResult
>
callback
=
(
_
)
=>
{
};
private
static
Mock
<
IRegion
>
mockRegion
;
private
static
Mock
<
IRegion
>
mockRegion
;
private
static
Mock
<
IRegionNavigationService
>
mockNavigation
;
private
static
Mock
<
IRegionNavigationService
>
mockNavigation
;
...
@@ -53,51 +53,51 @@ namespace Prism.Forms.Regions.Tests
...
@@ -53,51 +53,51 @@ namespace Prism.Forms.Regions.Tests
[
Fact
]
[
Fact
]
public
void
WhenNonExistentRegion_ReturnNavigationResultFalse
()
public
void
WhenNonExistentRegion_ReturnNavigationResultFalse
()
{
{
IRegion
NavigationResult
result
;
NavigationResult
result
;
result
=
null
;
result
=
null
;
regionManager
.
RequestNavigate
(
nonExistentRegion
,
source
,
(
r
)
=>
result
=
r
,
parameters
);
regionManager
.
RequestNavigate
(
nonExistentRegion
,
source
,
(
r
)
=>
result
=
r
,
parameters
);
Assert
.
Equal
(
false
,
result
.
Result
);
Assert
.
False
(
result
.
Success
);
result
=
null
;
result
=
null
;
regionManager
.
RequestNavigate
(
nonExistentRegion
,
source
,
(
r
)
=>
result
=
r
);
regionManager
.
RequestNavigate
(
nonExistentRegion
,
source
,
(
r
)
=>
result
=
r
);
Assert
.
Equal
(
false
,
result
.
Result
);
Assert
.
False
(
result
.
Success
);
result
=
null
;
result
=
null
;
regionManager
.
RequestNavigate
(
nonExistentRegion
,
sourceUri
,
(
r
)
=>
result
=
r
,
parameters
);
regionManager
.
RequestNavigate
(
nonExistentRegion
,
sourceUri
,
(
r
)
=>
result
=
r
,
parameters
);
Assert
.
Equal
(
false
,
result
.
Result
);
Assert
.
False
(
result
.
Success
);
result
=
null
;
result
=
null
;
regionManager
.
RequestNavigate
(
nonExistentRegion
,
sourceUri
,
(
r
)
=>
result
=
r
);
regionManager
.
RequestNavigate
(
nonExistentRegion
,
sourceUri
,
(
r
)
=>
result
=
r
);
Assert
.
Equal
(
false
,
result
.
Result
);
Assert
.
False
(
result
.
Success
);
}
}
[
Fact
]
[
Fact
]
public
void
DelegatesCallToRegion_RegionSource
()
public
void
DelegatesCallToRegion_RegionSource
()
{
{
regionManager
.
RequestNavigate
(
region
,
source
);
regionManager
.
RequestNavigate
(
region
,
source
);
mockNavigation
.
Verify
((
r
)
=>
r
.
RequestNavigate
(
sourceUri
,
It
.
IsAny
<
Action
<
IRegion
NavigationResult
>>(),
null
));
mockNavigation
.
Verify
((
r
)
=>
r
.
RequestNavigate
(
sourceUri
,
It
.
IsAny
<
Action
<
NavigationResult
>>(),
null
));
}
}
[
Fact
]
[
Fact
]
public
void
DelegatesCallToRegion_RegionTarget
()
public
void
DelegatesCallToRegion_RegionTarget
()
{
{
regionManager
.
RequestNavigate
(
region
,
sourceUri
);
regionManager
.
RequestNavigate
(
region
,
sourceUri
);
mockNavigation
.
Verify
((
r
)
=>
r
.
RequestNavigate
(
sourceUri
,
It
.
IsAny
<
Action
<
IRegion
NavigationResult
>>(),
null
));
mockNavigation
.
Verify
((
r
)
=>
r
.
RequestNavigate
(
sourceUri
,
It
.
IsAny
<
Action
<
NavigationResult
>>(),
null
));
}
}
[
Fact
]
[
Fact
]
public
void
DelegatesCallToRegion_RegionSourceParameters
()
public
void
DelegatesCallToRegion_RegionSourceParameters
()
{
{
regionManager
.
RequestNavigate
(
region
,
source
,
parameters
);
regionManager
.
RequestNavigate
(
region
,
source
,
parameters
);
mockRegion
.
Verify
((
r
)
=>
r
.
NavigationService
.
RequestNavigate
(
sourceUri
,
It
.
IsAny
<
Action
<
IRegion
NavigationResult
>>(),
parameters
));
mockRegion
.
Verify
((
r
)
=>
r
.
NavigationService
.
RequestNavigate
(
sourceUri
,
It
.
IsAny
<
Action
<
NavigationResult
>>(),
parameters
));
}
}
[
Fact
]
[
Fact
]
public
void
DelegatesCallToRegion_RegionSourceUriParameters
()
public
void
DelegatesCallToRegion_RegionSourceUriParameters
()
{
{
regionManager
.
RequestNavigate
(
region
,
sourceUri
,
parameters
);
regionManager
.
RequestNavigate
(
region
,
sourceUri
,
parameters
);
mockRegion
.
Verify
((
r
)
=>
r
.
NavigationService
.
RequestNavigate
(
sourceUri
,
It
.
IsAny
<
Action
<
IRegion
NavigationResult
>>(),
parameters
));
mockRegion
.
Verify
((
r
)
=>
r
.
NavigationService
.
RequestNavigate
(
sourceUri
,
It
.
IsAny
<
Action
<
NavigationResult
>>(),
parameters
));
}
}
[
Fact
]
[
Fact
]
...
...
tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationJournalFixture.cs
浏览文件 @
6a09b9ba
此差异已折叠。
点击以展开。
tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationServiceFixture.cs
浏览文件 @
6a09b9ba
此差异已折叠。
点击以展开。
tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionViewRegistryFixture.cs
浏览文件 @
6a09b9ba
...
@@ -44,7 +44,7 @@ namespace Prism.Forms.Regions.Tests
...
@@ -44,7 +44,7 @@ namespace Prism.Forms.Regions.Tests
Assert
.
NotNull
(
listener
.
onViewRegisteredArguments
);
Assert
.
NotNull
(
listener
.
onViewRegisteredArguments
);
Assert
.
NotNull
(
listener
.
onViewRegisteredArguments
.
GetView
);
Assert
.
NotNull
(
listener
.
onViewRegisteredArguments
.
GetView
);
var
result
=
listener
.
onViewRegisteredArguments
.
GetView
();
var
result
=
listener
.
onViewRegisteredArguments
.
GetView
(
containerMock
.
Object
);
Assert
.
NotNull
(
result
);
Assert
.
NotNull
(
result
);
Assert
.
IsType
<
MockContentObject
>(
result
);
Assert
.
IsType
<
MockContentObject
>(
result
);
}
}
...
...
tests/Maui/Prism.DryIoc.Maui.Tests/Fixtures/Regions/RegionFixture.cs
浏览文件 @
6a09b9ba
...
@@ -101,7 +101,8 @@ public class RegionFixture : TestBase
...
@@ -101,7 +101,8 @@ public class RegionFixture : TestBase
var
region
=
regionManager
.
Regions
.
First
(
x
=>
x
.
Name
==
"ContentRegion"
);
var
region
=
regionManager
.
Regions
.
First
(
x
=>
x
.
Name
==
"ContentRegion"
);
var
activeView
=
region
.
ActiveViews
.
First
();
var
activeView
=
region
.
ActiveViews
.
First
();
Assert
.
IsType
<
MockRegionViewA
>(
activeView
);
Assert
.
IsType
<
MockRegionViewA
>(
activeView
);
var
viewModel
=
activeView
.
BindingContext
as
MockRegionViewAViewModel
;
var
activeViewAsMockRegionViewA
=
activeView
as
MockRegionViewA
;
var
viewModel
=
activeViewAsMockRegionViewA
.
BindingContext
as
MockRegionViewAViewModel
;
Assert
.
NotNull
(
viewModel
);
Assert
.
NotNull
(
viewModel
);
Assert
.
NotNull
(
viewModel
.
Page
);
Assert
.
NotNull
(
viewModel
.
Page
);
...
...
tests/Maui/Prism.DryIoc.Maui.Tests/Mocks/ViewModels/MockRegionViewAViewModel.cs
浏览文件 @
6a09b9ba
...
@@ -29,17 +29,17 @@ public class MockRegionViewAViewModel : BindableBase, IRegionAware, IInitialize
...
@@ -29,17 +29,17 @@ public class MockRegionViewAViewModel : BindableBase, IRegionAware, IInitialize
Message
=
message
;
Message
=
message
;
}
}
public
bool
IsNavigationTarget
(
I
NavigationContext
navigationContext
)
public
bool
IsNavigationTarget
(
NavigationContext
navigationContext
)
{
{
return
navigationContext
.
NavigatedName
()
==
"MockRegionViewA"
;
return
navigationContext
.
NavigatedName
()
==
"MockRegionViewA"
;
}
}
public
void
OnNavigatedFrom
(
I
NavigationContext
navigationContext
)
public
void
OnNavigatedFrom
(
NavigationContext
navigationContext
)
{
{
}
}
public
void
OnNavigatedTo
(
I
NavigationContext
navigationContext
)
public
void
OnNavigatedTo
(
NavigationContext
navigationContext
)
{
{
}
}
...
...
tests/Wpf/Prism.IocContainer.Wpf.Tests.Support/Mocks/MockRegionManager.cs
浏览文件 @
6a09b9ba
using
System
;
using
System
;
using
Prism.Ioc
;
using
Prism.Navigation
;
using
Prism.Navigation
;
using
Prism.Regions
;
using
Prism.Regions
;
...
@@ -89,5 +90,10 @@ namespace Prism.IocContainer.Wpf.Tests.Support.Mocks
...
@@ -89,5 +90,10 @@ namespace Prism.IocContainer.Wpf.Tests.Support.Mocks
{
{
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
public
IRegionManager
RegisterViewWithRegion
(
string
regionName
,
Func
<
IContainerProvider
,
object
>
getContentDelegate
)
{
throw
new
NotImplementedException
();
}
}
}
}
}
tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionManager.cs
浏览文件 @
6a09b9ba
using
System
;
using
System
;
using
System.Collections
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
Prism.Ioc
;
using
Prism.Navigation
;
using
Prism.Navigation
;
using
Prism.Regions
;
using
Prism.Regions
;
...
@@ -37,7 +38,7 @@ namespace Prism.Wpf.Tests.Mocks
...
@@ -37,7 +38,7 @@ namespace Prism.Wpf.Tests.Mocks
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
public
IRegionManager
RegisterViewWithRegion
(
string
regionName
,
Func
<
object
>
getContentDelegate
)
public
IRegionManager
RegisterViewWithRegion
(
string
regionName
,
Func
<
IContainerProvider
,
object
>
getContentDelegate
)
{
{
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
...
...
tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/AutoPopulateRegionBehaviorFixture.cs
浏览文件 @
6a09b9ba
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
Prism.Ioc
;
using
Prism.Regions
;
using
Prism.Regions
;
using
Prism.Regions.Behaviors
;
using
Prism.Regions.Behaviors
;
using
Prism.Wpf.Tests.Mocks
;
using
Prism.Wpf.Tests.Mocks
;
...
@@ -94,7 +95,7 @@ namespace Prism.Wpf.Tests.Regions.Behaviors
...
@@ -94,7 +95,7 @@ namespace Prism.Wpf.Tests.Regions.Behaviors
public
event
EventHandler
<
ViewRegisteredEventArgs
>
ContentRegistered
;
public
event
EventHandler
<
ViewRegisteredEventArgs
>
ContentRegistered
;
public
IEnumerable
<
object
>
GetContents
(
string
regionName
)
public
IEnumerable
<
object
>
GetContents
(
string
regionName
,
IContainerProvider
container
)
{
{
GetContentsCalled
=
true
;
GetContentsCalled
=
true
;
this
.
GetContentsArgumentRegionName
=
regionName
;
this
.
GetContentsArgumentRegionName
=
regionName
;
...
@@ -103,7 +104,7 @@ namespace Prism.Wpf.Tests.Regions.Behaviors
...
@@ -103,7 +104,7 @@ namespace Prism.Wpf.Tests.Regions.Behaviors
public
void
RaiseContentRegistered
(
string
regionName
,
object
view
)
public
void
RaiseContentRegistered
(
string
regionName
,
object
view
)
{
{
this
.
ContentRegistered
(
this
,
new
ViewRegisteredEventArgs
(
regionName
,
()
=>
view
));
this
.
ContentRegistered
(
this
,
new
ViewRegisteredEventArgs
(
regionName
,
_
=>
view
));
}
}
public
void
RegisterViewWithRegion
(
string
regionName
,
Type
viewType
)
public
void
RegisterViewWithRegion
(
string
regionName
,
Type
viewType
)
...
@@ -111,7 +112,12 @@ namespace Prism.Wpf.Tests.Regions.Behaviors
...
@@ -111,7 +112,12 @@ namespace Prism.Wpf.Tests.Regions.Behaviors
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
public
void
RegisterViewWithRegion
(
string
regionName
,
Func
<
object
>
getContentDelegate
)
public
void
RegisterViewWithRegion
(
string
regionName
,
Func
<
IContainerProvider
,
object
>
getContentDelegate
)
{
throw
new
NotImplementedException
();
}
public
void
RegisterViewWithRegion
(
string
regionName
,
string
targetName
)
{
{
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
...
...
tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/RegionManagerRegistrationBehaviorFixture.cs
浏览文件 @
6a09b9ba
...
@@ -3,6 +3,7 @@ using System.Collections;
...
@@ -3,6 +3,7 @@ using System.Collections;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Windows.Controls
;
using
System.Windows.Controls
;
using
Prism.Ioc
;
using
Prism.Navigation
;
using
Prism.Navigation
;
using
Prism.Regions
;
using
Prism.Regions
;
using
Prism.Regions.Behaviors
;
using
Prism.Regions.Behaviors
;
...
@@ -242,7 +243,7 @@ namespace Prism.Wpf.Tests.Regions.Behaviors
...
@@ -242,7 +243,7 @@ namespace Prism.Wpf.Tests.Regions.Behaviors
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
public
IRegionManager
RegisterViewWithRegion
(
string
regionName
,
Func
<
object
>
getContentDelegate
)
public
IRegionManager
RegisterViewWithRegion
(
string
regionName
,
Func
<
IContainerProvider
,
object
>
getContentDelegate
)
{
{
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
...
...
tests/Wpf/Prism.Wpf.Tests/Regions/NavigationAsyncExtensionsFixture.cs
浏览文件 @
6a09b9ba
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
using
System
;
using
System
;
using
Moq
;
using
Moq
;
using
Prism.Navigation
;
using
Prism.Regions
;
using
Prism.Regions
;
using
Xunit
;
using
Xunit
;
...
...
tests/Wpf/Prism.Wpf.Tests/Regions/RegionFixture.cs
浏览文件 @
6a09b9ba
...
@@ -471,7 +471,7 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -471,7 +471,7 @@ namespace Prism.Wpf.Tests.Regions
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
public
IRegionManager
RegisterViewWithRegion
(
string
regionName
,
Func
<
object
>
getContentDelegate
)
public
IRegionManager
RegisterViewWithRegion
(
string
regionName
,
Func
<
IContainerProvider
,
object
>
getContentDelegate
)
{
{
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
...
...
tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerFixture.cs
浏览文件 @
6a09b9ba
...
@@ -408,9 +408,9 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -408,9 +408,9 @@ namespace Prism.Wpf.Tests.Regions
var
mockRegionContentRegistry
=
new
MockRegionContentRegistry
();
var
mockRegionContentRegistry
=
new
MockRegionContentRegistry
();
string
regionName
=
null
;
string
regionName
=
null
;
Func
<
object
>
contentDelegate
=
null
;
Func
<
IContainerProvider
,
object
>
contentDelegate
=
null
;
Func
<
object
>
expectedDelegate
=
()
=>
true
;
Func
<
IContainerProvider
,
object
>
expectedDelegate
=
_
=>
true
;
mockRegionContentRegistry
.
RegisterContentWithDelegate
=
(
name
,
usedDelegate
)
=>
mockRegionContentRegistry
.
RegisterContentWithDelegate
=
(
name
,
usedDelegate
)
=>
{
{
regionName
=
name
;
regionName
=
name
;
...
@@ -474,19 +474,24 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -474,19 +474,24 @@ namespace Prism.Wpf.Tests.Regions
internal
class
MockRegionContentRegistry
:
IRegionViewRegistry
internal
class
MockRegionContentRegistry
:
IRegionViewRegistry
{
{
public
Func
<
string
,
Type
,
object
>
RegisterContentWithViewType
;
public
Func
<
string
,
Type
,
object
>
RegisterContentWithViewType
;
public
Func
<
string
,
Func
<
object
>,
object
>
RegisterContentWithDelegate
;
public
Func
<
string
,
Func
<
IContainerProvider
,
object
>,
object
>
RegisterContentWithDelegate
;
public
event
EventHandler
<
ViewRegisteredEventArgs
>
ContentRegistered
;
public
event
EventHandler
<
ViewRegisteredEventArgs
>
ContentRegistered
;
public
IEnumerable
<
object
>
GetContents
(
string
regionName
)
public
IEnumerable
<
object
>
GetContents
(
string
regionName
,
IContainerProvider
container
)
{
{
return
null
;
return
null
;
}
}
public
void
RegisterViewWithRegion
(
string
regionName
,
string
targetName
)
{
throw
new
NotImplementedException
();
}
void
IRegionViewRegistry
.
RegisterViewWithRegion
(
string
regionName
,
Type
viewType
)
void
IRegionViewRegistry
.
RegisterViewWithRegion
(
string
regionName
,
Type
viewType
)
{
{
RegisterContentWithViewType
?.
Invoke
(
regionName
,
viewType
);
RegisterContentWithViewType
?.
Invoke
(
regionName
,
viewType
);
}
}
void
IRegionViewRegistry
.
RegisterViewWithRegion
(
string
regionName
,
Func
<
object
>
getContentDelegate
)
void
IRegionViewRegistry
.
RegisterViewWithRegion
(
string
regionName
,
Func
<
IContainerProvider
,
object
>
getContentDelegate
)
{
{
RegisterContentWithDelegate
?.
Invoke
(
regionName
,
getContentDelegate
);
RegisterContentWithDelegate
?.
Invoke
(
regionName
,
getContentDelegate
);
...
...
tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerRequestNavigateFixture.cs
浏览文件 @
6a09b9ba
...
@@ -56,19 +56,19 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -56,19 +56,19 @@ namespace Prism.Wpf.Tests.Regions
result
=
null
;
result
=
null
;
regionManager
.
RequestNavigate
(
nonExistentRegion
,
source
,
(
r
)
=>
result
=
r
,
parameters
);
regionManager
.
RequestNavigate
(
nonExistentRegion
,
source
,
(
r
)
=>
result
=
r
,
parameters
);
Assert
.
Equal
(
false
,
result
.
Result
);
Assert
.
False
(
result
.
Success
);
result
=
null
;
result
=
null
;
regionManager
.
RequestNavigate
(
nonExistentRegion
,
source
,
(
r
)
=>
result
=
r
);
regionManager
.
RequestNavigate
(
nonExistentRegion
,
source
,
(
r
)
=>
result
=
r
);
Assert
.
Equal
(
false
,
result
.
Result
);
Assert
.
False
(
result
.
Success
);
result
=
null
;
result
=
null
;
regionManager
.
RequestNavigate
(
nonExistentRegion
,
sourceUri
,
(
r
)
=>
result
=
r
,
parameters
);
regionManager
.
RequestNavigate
(
nonExistentRegion
,
sourceUri
,
(
r
)
=>
result
=
r
,
parameters
);
Assert
.
Equal
(
false
,
result
.
Result
);
Assert
.
False
(
result
.
Success
);
result
=
null
;
result
=
null
;
regionManager
.
RequestNavigate
(
nonExistentRegion
,
sourceUri
,
(
r
)
=>
result
=
r
);
regionManager
.
RequestNavigate
(
nonExistentRegion
,
sourceUri
,
(
r
)
=>
result
=
r
);
Assert
.
Equal
(
false
,
result
.
Result
);
Assert
.
False
(
result
.
Success
);
}
}
[
Fact
]
[
Fact
]
...
...
tests/Wpf/Prism.Wpf.Tests/Regions/RegionNavigationServiceFixture.new.cs
浏览文件 @
6a09b9ba
...
@@ -4,6 +4,7 @@ using System.Linq;
...
@@ -4,6 +4,7 @@ using System.Linq;
using
System.Windows
;
using
System.Windows
;
using
Moq
;
using
Moq
;
using
Prism.Ioc
;
using
Prism.Ioc
;
using
Prism.Navigation
;
using
Prism.Regions
;
using
Prism.Regions
;
using
Xunit
;
using
Xunit
;
...
@@ -40,7 +41,7 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -40,7 +41,7 @@ namespace Prism.Wpf.Tests.Regions
// Act
// Act
bool
isNavigationSuccessful
=
false
;
bool
isNavigationSuccessful
=
false
;
target
.
RequestNavigate
(
viewUri
,
nr
=>
isNavigationSuccessful
=
nr
.
Result
==
true
);
target
.
RequestNavigate
(
viewUri
,
nr
=>
isNavigationSuccessful
=
nr
.
Success
==
true
);
// Verify
// Verify
Assert
.
True
(
isNavigationSuccessful
);
Assert
.
True
(
isNavigationSuccessful
);
...
@@ -76,7 +77,7 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -76,7 +77,7 @@ namespace Prism.Wpf.Tests.Regions
// Act
// Act
bool
isNavigationSuccessful
=
false
;
bool
isNavigationSuccessful
=
false
;
target
.
RequestNavigate
(
viewUri
,
nr
=>
isNavigationSuccessful
=
nr
.
Result
==
true
);
target
.
RequestNavigate
(
viewUri
,
nr
=>
isNavigationSuccessful
=
nr
.
Success
==
true
);
// Verify
// Verify
Assert
.
True
(
isNavigationSuccessful
);
Assert
.
True
(
isNavigationSuccessful
);
...
@@ -116,7 +117,7 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -116,7 +117,7 @@ namespace Prism.Wpf.Tests.Regions
new
Uri
(
otherType
.
GetType
().
Name
,
UriKind
.
Relative
),
new
Uri
(
otherType
.
GetType
().
Name
,
UriKind
.
Relative
),
nr
=>
nr
=>
{
{
error
=
nr
.
E
rror
;
error
=
nr
.
E
xception
;
});
});
// Verify
// Verify
...
@@ -148,9 +149,9 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -148,9 +149,9 @@ namespace Prism.Wpf.Tests.Regions
target
.
RequestNavigate
((
Uri
)
null
,
nr
=>
navigationResult
=
nr
);
target
.
RequestNavigate
((
Uri
)
null
,
nr
=>
navigationResult
=
nr
);
// Verify
// Verify
Assert
.
False
(
navigationResult
.
Result
.
Value
);
Assert
.
False
(
navigationResult
.
Success
);
Assert
.
NotNull
(
navigationResult
.
E
rror
);
Assert
.
NotNull
(
navigationResult
.
E
xception
);
Assert
.
IsType
<
ArgumentNullException
>(
navigationResult
.
E
rror
);
Assert
.
IsType
<
ArgumentNullException
>(
navigationResult
.
E
xception
);
}
}
[
Fact
]
[
Fact
]
...
@@ -435,7 +436,7 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -435,7 +436,7 @@ namespace Prism.Wpf.Tests.Regions
// Act
// Act
var
navigationSucceeded
=
false
;
var
navigationSucceeded
=
false
;
target
.
RequestNavigate
(
navigationUri
,
nr
=>
{
navigationSucceeded
=
nr
.
Result
==
true
;
});
target
.
RequestNavigate
(
navigationUri
,
nr
=>
{
navigationSucceeded
=
nr
.
Success
==
true
;
});
// Verify
// Verify
view1Mock
.
VerifyAll
();
view1Mock
.
VerifyAll
();
...
@@ -480,7 +481,7 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -480,7 +481,7 @@ namespace Prism.Wpf.Tests.Regions
// Act
// Act
var
navigationFailed
=
false
;
var
navigationFailed
=
false
;
target
.
RequestNavigate
(
navigationUri
,
nr
=>
{
navigationFailed
=
nr
.
Result
==
false
;
});
target
.
RequestNavigate
(
navigationUri
,
nr
=>
{
navigationFailed
=
nr
.
Success
==
false
;
});
// Verify
// Verify
view1Mock
.
VerifyAll
();
view1Mock
.
VerifyAll
();
...
@@ -567,7 +568,7 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -567,7 +568,7 @@ namespace Prism.Wpf.Tests.Regions
// Act
// Act
var
navigationSucceeded
=
false
;
var
navigationSucceeded
=
false
;
target
.
RequestNavigate
(
navigationUri
,
nr
=>
{
navigationSucceeded
=
nr
.
Result
==
true
;
});
target
.
RequestNavigate
(
navigationUri
,
nr
=>
{
navigationSucceeded
=
nr
.
Success
==
true
;
});
// Verify
// Verify
view1DataContextMock
.
VerifyAll
();
view1DataContextMock
.
VerifyAll
();
...
@@ -614,7 +615,7 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -614,7 +615,7 @@ namespace Prism.Wpf.Tests.Regions
// Act
// Act
var
navigationFailed
=
false
;
var
navigationFailed
=
false
;
target
.
RequestNavigate
(
navigationUri
,
nr
=>
{
navigationFailed
=
nr
.
Result
==
false
;
});
target
.
RequestNavigate
(
navigationUri
,
nr
=>
{
navigationFailed
=
nr
.
Success
==
false
;
});
// Verify
// Verify
view1DataContextMock
.
VerifyAll
();
view1DataContextMock
.
VerifyAll
();
...
@@ -662,8 +663,8 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -662,8 +663,8 @@ namespace Prism.Wpf.Tests.Regions
bool
firstNavigation
=
false
;
bool
firstNavigation
=
false
;
bool
secondNavigation
=
false
;
bool
secondNavigation
=
false
;
target
.
RequestNavigate
(
navigationUri
,
nr
=>
firstNavigation
=
nr
.
Result
.
Value
);
target
.
RequestNavigate
(
navigationUri
,
nr
=>
firstNavigation
=
nr
.
Success
);
target
.
RequestNavigate
(
navigationUri
,
nr
=>
secondNavigation
=
nr
.
Result
.
Value
);
target
.
RequestNavigate
(
navigationUri
,
nr
=>
secondNavigation
=
nr
.
Success
);
Assert
.
Equal
(
2
,
confirmationRequests
.
Count
);
Assert
.
Equal
(
2
,
confirmationRequests
.
Count
);
...
@@ -717,8 +718,8 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -717,8 +718,8 @@ namespace Prism.Wpf.Tests.Regions
bool
firstNavigation
=
false
;
bool
firstNavigation
=
false
;
bool
secondNavigation
=
false
;
bool
secondNavigation
=
false
;
target
.
RequestNavigate
(
navigationUri
,
nr
=>
firstNavigation
=
nr
.
Result
.
Value
);
target
.
RequestNavigate
(
navigationUri
,
nr
=>
firstNavigation
=
nr
.
Success
);
target
.
RequestNavigate
(
navigationUri
,
nr
=>
secondNavigation
=
nr
.
Result
.
Value
);
target
.
RequestNavigate
(
navigationUri
,
nr
=>
secondNavigation
=
nr
.
Success
);
Assert
.
Equal
(
2
,
confirmationRequests
.
Count
);
Assert
.
Equal
(
2
,
confirmationRequests
.
Count
);
...
@@ -766,7 +767,7 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -766,7 +767,7 @@ namespace Prism.Wpf.Tests.Regions
// Act
// Act
bool
isNavigationSuccessful
=
false
;
bool
isNavigationSuccessful
=
false
;
target
.
RequestNavigate
(
viewUri
,
nr
=>
isNavigationSuccessful
=
nr
.
Result
==
true
);
target
.
RequestNavigate
(
viewUri
,
nr
=>
isNavigationSuccessful
=
nr
.
Success
==
true
);
// Verify
// Verify
Assert
.
True
(
isNavigationSuccessful
);
Assert
.
True
(
isNavigationSuccessful
);
...
@@ -810,7 +811,7 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -810,7 +811,7 @@ namespace Prism.Wpf.Tests.Regions
// Act
// Act
bool
isNavigationSuccessful
=
false
;
bool
isNavigationSuccessful
=
false
;
target
.
RequestNavigate
(
viewUri
,
nr
=>
isNavigationSuccessful
=
nr
.
Result
==
true
);
target
.
RequestNavigate
(
viewUri
,
nr
=>
isNavigationSuccessful
=
nr
.
Success
==
true
);
// Verify
// Verify
Assert
.
True
(
isNavigationSuccessful
);
Assert
.
True
(
isNavigationSuccessful
);
...
@@ -850,7 +851,7 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -850,7 +851,7 @@ namespace Prism.Wpf.Tests.Regions
navigationCallback
(
true
);
navigationCallback
(
true
);
Assert
.
NotNull
(
result
);
Assert
.
NotNull
(
result
);
Assert
.
Same
(
targetException
,
result
.
E
rror
);
Assert
.
Same
(
targetException
,
result
.
E
xception
);
}
}
[
Fact
]
[
Fact
]
...
@@ -1002,7 +1003,7 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -1002,7 +1003,7 @@ namespace Prism.Wpf.Tests.Regions
RegionNavigationService
target
=
new
RegionNavigationService
(
container
,
contentLoader
,
journal
);
RegionNavigationService
target
=
new
RegionNavigationService
(
container
,
contentLoader
,
journal
);
Exception
error
=
null
;
Exception
error
=
null
;
target
.
RequestNavigate
(
navigationUri
,
nr
=>
error
=
nr
.
E
rror
);
target
.
RequestNavigate
(
navigationUri
,
nr
=>
error
=
nr
.
E
xception
);
Assert
.
NotNull
(
error
);
Assert
.
NotNull
(
error
);
Assert
.
IsType
<
InvalidOperationException
>(
error
);
Assert
.
IsType
<
InvalidOperationException
>(
error
);
...
@@ -1021,7 +1022,7 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -1021,7 +1022,7 @@ namespace Prism.Wpf.Tests.Regions
};
};
Exception
error
=
null
;
Exception
error
=
null
;
target
.
RequestNavigate
(
null
,
nr
=>
error
=
nr
.
E
rror
);
target
.
RequestNavigate
(
null
,
nr
=>
error
=
nr
.
E
xception
);
Assert
.
NotNull
(
error
);
Assert
.
NotNull
(
error
);
Assert
.
IsType
<
ArgumentNullException
>(
error
);
Assert
.
IsType
<
ArgumentNullException
>(
error
);
...
@@ -1062,7 +1063,7 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -1062,7 +1063,7 @@ namespace Prism.Wpf.Tests.Regions
// Act
// Act
bool
?
isNavigationSuccessful
=
null
;
bool
?
isNavigationSuccessful
=
null
;
target
.
RequestNavigate
(
new
Uri
(
"invalid"
,
UriKind
.
Relative
),
nr
=>
isNavigationSuccessful
=
nr
.
Result
);
target
.
RequestNavigate
(
new
Uri
(
"invalid"
,
UriKind
.
Relative
),
nr
=>
isNavigationSuccessful
=
nr
.
Success
);
// Verify
// Verify
Assert
.
False
(
isNavigationSuccessful
.
Value
);
Assert
.
False
(
isNavigationSuccessful
.
Value
);
...
@@ -1121,7 +1122,7 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -1121,7 +1122,7 @@ namespace Prism.Wpf.Tests.Regions
// Act
// Act
bool
?
isNavigationSuccessful
=
null
;
bool
?
isNavigationSuccessful
=
null
;
target
.
RequestNavigate
(
navigationUri
,
nr
=>
isNavigationSuccessful
=
nr
.
Result
);
target
.
RequestNavigate
(
navigationUri
,
nr
=>
isNavigationSuccessful
=
nr
.
Success
);
// Verify
// Verify
view1Mock
.
VerifyAll
();
view1Mock
.
VerifyAll
();
...
@@ -1183,7 +1184,7 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -1183,7 +1184,7 @@ namespace Prism.Wpf.Tests.Regions
// Act
// Act
bool
?
isNavigationSuccessful
=
null
;
bool
?
isNavigationSuccessful
=
null
;
target
.
RequestNavigate
(
navigationUri
,
nr
=>
isNavigationSuccessful
=
nr
.
Result
);
target
.
RequestNavigate
(
navigationUri
,
nr
=>
isNavigationSuccessful
=
nr
.
Success
);
// Verify
// Verify
viewModel1Mock
.
VerifyAll
();
viewModel1Mock
.
VerifyAll
();
...
...
tests/Wpf/Prism.Wpf.Tests/Regions/RegionViewRegistryFixture.cs
浏览文件 @
6a09b9ba
...
@@ -44,7 +44,7 @@ namespace Prism.Wpf.Tests.Regions
...
@@ -44,7 +44,7 @@ namespace Prism.Wpf.Tests.Regions
Assert
.
NotNull
(
listener
.
onViewRegisteredArguments
);
Assert
.
NotNull
(
listener
.
onViewRegisteredArguments
);
Assert
.
NotNull
(
listener
.
onViewRegisteredArguments
.
GetView
);
Assert
.
NotNull
(
listener
.
onViewRegisteredArguments
.
GetView
);
var
result
=
listener
.
onViewRegisteredArguments
.
GetView
();
var
result
=
listener
.
onViewRegisteredArguments
.
GetView
(
containerMock
.
Object
);
Assert
.
NotNull
(
result
);
Assert
.
NotNull
(
result
);
Assert
.
IsType
<
MockContentObject
>(
result
);
Assert
.
IsType
<
MockContentObject
>(
result
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录