Skip to content

Commit

Permalink
编写相应的单元测试
Browse files Browse the repository at this point in the history
  • Loading branch information
ShimizuShiori committed Apr 16, 2020
1 parent 6d40d3b commit 16e479d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Reface.AppStarter.Tests/ConfigCreatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public void GetConfig()
var app = new AppSetup().Start(new TestAppModule());
var container = app.GetAppContainer<IComponentContainer>();
var config = container.CreateComponent<SomeConfigWithoutAttribute>();
Assert.AreEqual("Test", config.PlayerName);
Assert.AreEqual("NoName", config.PlayerName);
Assert.AreEqual(1, config.RootId);
Assert.AreEqual(false, config.CanGenerateMinusNumber);
Assert.AreEqual(true, config.CanGenerateMinusNumber);
Assert.AreEqual(123456, config.Seed);
}
}
Expand Down
10 changes: 8 additions & 2 deletions src/Reface.AppStarter.Tests/app.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"$schema": "./app.schema.json",
"$schema": "./bin/Debug/app.schema.json",
"App": {
"GenerateConfigJsonSchema": true
},
"Test": {
"Mode": "Dev",
"IdList": [
1,
1,
2,
3,
4
Expand All @@ -25,5 +25,11 @@
},
"Test2": {
"Mode":"Dev"
},
"Game": {
"CanGenerateMinusNumber": true,
"PlayerName": "NoName",
"RootId": 1,
"Seed": 123456
}
}
26 changes: 24 additions & 2 deletions src/Reface.AppStarter.Tests/app.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
"description": "Test2Config",
"properties": {
"Mode": {
"description": "Mode",
"description": "程序工作模式\nDev : 开发环境\nTst : 测试环境\nPrd : 生产环境",
"type": "string",
"enum": [
"Tst",
"Dev",
"Tst",
"Prd"
]
}
Expand Down Expand Up @@ -75,6 +75,28 @@
}
}
}
},
"Game": {
"type": "object",
"description": "某个不依赖 ConfigAttribute 的配置类",
"properties": {
"RootId": {
"description": "根ID",
"type": "number"
},
"CanGenerateMinusNumber": {
"description": "是否会生成负数",
"type": "boolean"
},
"Seed": {
"description": "种子",
"type": "number"
},
"PlayerName": {
"description": "玩家姓名",
"type": "string"
}
}
}
}
}

0 comments on commit 16e479d

Please sign in to comment.