File tree Expand file tree Collapse file tree 6 files changed +15
-54
lines changed Expand file tree Collapse file tree 6 files changed +15
-54
lines changed Original file line number Diff line number Diff line change 3535 </ItemGroup >
3636 <ItemGroup >
3737 <Compile Include =" CatLib\ApplicationTests.cs" />
38- <Compile Include =" CatLib\AppTests.cs" />
3938 <Compile Include =" CatLib\FacaedTests.cs" />
4039 <Compile Include =" CatLib\GlobalDispatcherTests.cs" />
4140 <Compile Include =" CatLib\TypeExtendTests.cs" />
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -242,7 +242,16 @@ public void TestTerminate()
242242 Assert . AreEqual ( 1 , num ++ ) ;
243243 } ) ;
244244 App . Terminate ( ) ;
245- Assert . AreNotEqual ( oldApp , App . Handler ) ;
245+ var isCall = false ;
246+ try
247+ {
248+ Assert . AreNotEqual ( oldApp , App . Handler ) ;
249+ }
250+ catch ( LogicException )
251+ {
252+ isCall = true ;
253+ }
254+ Assert . AreEqual ( true , isCall ) ;
246255 Assert . AreEqual ( 2 , num ) ;
247256 }
248257
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ public class TypeExtendTests
1919 [ TestMethod ]
2020 public void TestGetService ( )
2121 {
22+ var app = new Application ( ) ;
2223 Assert . AreEqual ( App . Type2Service < TypeExtendTests > ( ) , typeof ( TypeExtendTests ) . ToService ( ) ) ;
2324 }
2425 }
Original file line number Diff line number Diff line change @@ -48,39 +48,25 @@ public static event Action<IApplication> OnNewApplication
4848 /// </summary>
4949 private static IApplication instance ;
5050
51- /// <summary>
52- /// 自动生成Application
53- /// </summary>
54- public static bool AutoInstance { get ; set ; } = true ;
55-
5651 /// <summary>
5752 /// CatLib实例
5853 /// </summary>
5954 public static IApplication Handler
6055 {
6156 get
6257 {
63- if ( instance == null && ! AutoInstance )
58+ if ( instance == null )
6459 {
65- throw new LogicException ( "The Application does not instance " ) ;
60+ throw new LogicException ( "The Application does not created, please call new Application() first. " ) ;
6661 }
67- return instance ?? New ( ) ;
62+ return instance ;
6863 }
6964 set
7065 {
7166 instance = value ;
7267 onNewApplication ? . Invoke ( instance ) ;
7368 }
7469 }
75-
76- /// <summary>
77- /// 创建CatLib实例
78- /// </summary>
79- /// <returns>CatLib实例</returns>
80- protected static IApplication New ( )
81- {
82- return Application . New ( ) ;
83- }
8470 #endregion
8571
8672 #region Application API
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ namespace CatLib
1616 /// <summary>
1717 /// 绑定关系临时数据,用于支持链式调用
1818 /// </summary>
19+ /// <typeparam name="TReturn">返回类型</typeparam>
1920 public interface IGivenData < TReturn >
2021 {
2122 /// <summary>
You can’t perform that action at this time.
0 commit comments