public void DeleteTest() { var account = TestHelper.GetTestAccount(); var user = TestHelper.GetAccountAdminUser(account.Id); var component = account.CreateTestApplicationComponent(); var unitTestType = TestHelper.CreateTestUnitTestType(account.Id); var service = DispatcherHelper.GetDispatcherService(); // Создадим проверку var request = new GetOrCreateUnitTestRequest() { Token = account.GetCoreToken(), Data = new GetOrCreateUnitTestRequestData() { DisplayName = "Новый юнит-тест " + DateTime.Now.Ticks, SystemName = "Test.UnitTestType " + DateTime.Now.Ticks, ComponentId = component.Id, UnitTestTypeId = unitTestType.Id } }; var response = service.GetOrCreateUnitTest(request); Assert.True(response.Success); var unitTestId = response.Data.Id; // Проверим, что проверка есть в списке using (var controller = new UnitTestsController(account.Id, user.Id)) { var result = (ViewResultBase)controller.Index(); var listModel = (UnitTestsListModel)result.Model; Assert.True(listModel.UnitTestTypes.Any(t => t.UnitTests.Any(x => x.Id == unitTestId))); } // Удалим проверку using (var controller = new UnitTestsController(account.Id, user.Id)) { controller.Delete(unitTestId, "fake"); } account.SaveAllCaches(); // Проверим, что проверки нет в списке using (var controller = new UnitTestsController(account.Id, user.Id)) { var result = (ViewResultBase)controller.Index(); var listModel = (UnitTestsListModel)result.Model; Assert.False(listModel.UnitTestTypes.Any(t => t.UnitTests.Any(x => x.Id == unitTestId))); } }
public GetOrCreateUnitTestResponse GetOrCreateUnitTest(GetOrCreateUnitTestRequest request) { return(ExecuteAction <GetOrCreateUnitTestResponse>(request)); }
public GetOrCreateUnitTestResponse GetOrCreateUnitTest(GetOrCreateUnitTestRequest request) { return(Execute(() => InternalService.GetOrCreateUnitTest(request))); }