public async Task GetShouldGetEventCount() { await _actionSource.Dispatch(new Action("")); await _actionSource.Dispatch(new Action("")); var result = (OkObjectResult)await _controller.Get(); Assert.AreEqual(2, ((MonitoringDto)result.Value).EventCount); }
public void GetTest() { MonitoringController monitoringController; // 测试用例1 monitoringController = new MonitoringController(); monitoringController.Get((Dictionary <string, object>)null); Assert.IsNotNull((object)monitoringController); Assert.AreEqual <string>("127.0.0.1", ((BaseService)monitoringController).Server); Assert.AreEqual <int>(8080, ((BaseService)monitoringController).Port); // 测试用例2 Dictionary <string, object> dictionary; monitoringController = new MonitoringController(); dictionary = new Dictionary <string, object>(0); dictionary[""] = (object)null; monitoringController.Get(dictionary); Assert.IsNotNull((object)monitoringController); Assert.AreEqual <string>("127.0.0.1", ((BaseService)monitoringController).Server); Assert.AreEqual <int>(8080, ((BaseService)monitoringController).Port); }