public static string Vote_Details(Guid voteFormId, string departmentId, string ologyId) { Statistic_VoteFormDTO result = GeneralResult.GetVoteCollections(voteFormId, departmentId, ologyId); System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer(); return(js.Serialize(result)); }
public GeneralResult <string[]> upload2(Stream stream) { GeneralResult <string[]> result = new GeneralResult <string[]>(); try { List <string> paths = new List <string>(); MultipartParser parser = new MultipartParser(stream); string error; string file_name = Guid.NewGuid() + "." + parser.Filename.Split('.')[1]; string single = FileOperation.SaveFile(out error, file_name, parser.FileContents); single = single.Substring(AppHome.BaseDirectory.Length - 1); single = single.Replace("\\", "/"); if (error == "") { paths.Add(single); } result.success = true; result.data = paths.ToArray(); } catch (Exception ex) { SystemLog.WriteErrorLog("请求失败", "2002", ex.Message, ex.StackTrace); } return(result); }
public void GivenViewWithoutIllustrationPoints_WhenIllustrationPointsSetAndNotifiesObserver_ThenControlsSyncedAccordingly() { // Given var returnGeneralResult = false; var calculation = new TestCalculation(); GeneralResult <TestTopLevelIllustrationPoint> generalResult = GetGeneralResultWithTwoTopLevelIllustrationPoints(); var view = new TestGeneralResultIllustrationPointView(calculation, () => returnGeneralResult ? generalResult : null); ShowTestView(view); returnGeneralResult = true; // Precondition IllustrationPointsControl illustrationPointsControl = GetIllustrationPointsControl(view); CollectionAssert.IsEmpty(illustrationPointsControl.Data); // When calculation.NotifyObservers(); // Then AssertIllustrationPointControlItems(generalResult, illustrationPointsControl); }
public List <GeneralResult> DataTableToElement(DataTable table) { List <GeneralResult> vResult = new List <GeneralResult>(); try { foreach (DataRow row in table.Rows) { GeneralResult vgeneralResult = new GeneralResult { IdCityTour = Guid.Parse(Convert.ToString(row["id"])), IdCity = Guid.Parse(Convert.ToString(row["idcity"])), NameCityTour = Convert.ToString(row["name"]), IconCityTour = Convert.ToString(row["icon"]), Ordering = Convert.ToInt32(row["ordering"]) }; vResult.Add(vgeneralResult); } } catch (Exception vEx) { string vMessage = vEx.Message; vResult = new List <GeneralResult>(); } return(vResult); }
public void GetProperties_WithData_ReturnExpectedValues() { // Setup PartialProbabilisticFaultTreePipingOutput output = PipingTestDataGenerator.GetRandomPartialProbabilisticFaultTreePipingOutput(); // Call var properties = new ProbabilisticFaultTreePipingOutputProperties(output); // Assert Assert.AreEqual(ProbabilityFormattingHelper.Format(StatisticsConverter.ReliabilityToProbability(output.Reliability)), properties.Probability); Assert.AreEqual(output.Reliability, properties.Reliability, properties.Reliability.GetAccuracy()); GeneralResult <TopLevelFaultTreeIllustrationPoint> generalResult = output.GeneralResult; Assert.AreEqual(generalResult.GoverningWindDirection.Name, properties.WindDirection); int nrOfExpectedStochasts = generalResult.Stochasts.Count(); Assert.AreEqual(nrOfExpectedStochasts, properties.AlphaValues.Length); Assert.AreEqual(nrOfExpectedStochasts, properties.Durations.Length); Stochast expectedStochast = generalResult.Stochasts.First(); Assert.AreEqual(expectedStochast.Alpha, properties.AlphaValues[0].Alpha); Assert.AreEqual(expectedStochast.Duration, properties.Durations[0].Duration); int nrOfExpectedTopLevelIllustrationPoints = generalResult.TopLevelIllustrationPoints.Count(); Assert.AreEqual(nrOfExpectedTopLevelIllustrationPoints, properties.IllustrationPoints.Length); CollectionAssert.AreEqual(generalResult.TopLevelIllustrationPoints, properties.IllustrationPoints.Select(i => i.Data)); }
public void VersionIncrementTest() { string tcName = "version Number test case"; GeneralResult result = proxy.CreateTestCase(userName, BusinessRulesTestSuiteId, tcName, ApiTestProjectId, "This is a summary for an externally created test case", "auto,positive", 0, true, ActionOnDuplicatedName.CreateNewVersion , 2, 2); int versionNumber = result.additionalInfo.version_number; Console.WriteLine("Version Number first pass: {0}", result.additionalInfo.version_number); TestStep[] steps = new TestStep[3]; steps[0] = new TestStep(1, "<p>Step 1</p>", "<p>result 1</p>", true, 1); steps[1] = new TestStep(2, "<p>Step 2</p>", "<p>result 2</p>", true, 2); steps[2] = new TestStep(3, "<p>Step 3</p>", "<p>result 3</p>", true, 1); result = proxy.CreateTestCase(userName, BusinessRulesTestSuiteId, tcName, ApiTestProjectId, "This is a different summary for an externally created test case", steps, "auto,positive", 0, true, ActionOnDuplicatedName.CreateNewVersion, 2, 2); Console.WriteLine("Version Number second pass: {0}", result.additionalInfo.version_number); Assert.AreEqual(versionNumber + 1, result.additionalInfo.version_number, "Version number should have been incremented"); }
public void CreateTestSuite() { string name = string.Format("AutocreatedTestSuite at {0}", DateTime.Now.ToUniversalTime()); Assert.AreNotEqual(-1, ApiTestProjectId); Console.WriteLine("Creating TestSuite for TestProjectId = {0}", ApiTestProjectId); GeneralResult createResult = proxy.CreateTestSuite(ApiTestProjectId, name, "Here are some details"); Console.WriteLine("Result status:{0}, id:{1}, message:'{2}'", createResult.status, createResult.id, createResult.message); Assert.AreEqual(true, createResult.status, "Create did not return true"); Console.WriteLine("checking against all first level test suites"); List <Meyn.TestLink.TestSuite> result = proxy.GetFirstLevelTestSuitesForTestProject(ApiTestProjectId); bool found = false; foreach (Meyn.TestLink.TestSuite suite in result) { if (suite.name == testSuiteName1) { Console.Write("Looking at suite id:{0} '{1}'", suite.id, suite.name); } if (suite.id == createResult.id) { found = true; Console.WriteLine(" --- Found!"); Assert.AreEqual(name, suite.name, "Suite name is wrong"); break; } //else Console.WriteLine(" --- no match"); } Assert.IsTrue(found, "No Suite matched"); }
public void ReportTestCaseAgainstOlderBuild() { List <Build> builds = proxy.GetBuildsForTestPlan(PlanCalledAutomatedTesting.id); Assert.IsNotEmpty(builds, "Can't proceed. Got empty list of builds for plan"); // remove inactive builds for (int i = builds.Count - 1; i >= 0; i--) { if (builds[i].is_open == false) { builds.Remove(builds[i]); } } Assert.IsTrue(builds.Count > 1, "Can't proceed. Need at least two active builds"); // select oldest build (lowest id) Build target = builds[0]; foreach (Build b in builds) { if (target.id > b.id) { target = b; } } System.Console.WriteLine("Test case id:{0} against test build {1}:{2} recorded as failed", tcIdToHaveResults, target.id, target.name); GeneralResult result = proxy.ReportTCResult(tcIdToHaveResults, tPlanId, TestCaseResultStatus.Fail, platformId, buildid: target.id, notes: "test case assigned to older build"); Console.WriteLine("Status: '{0}', message: '{1}'", result.status, result.message); Assert.AreEqual(true, result.status); }
public void ReportATestCaseExecution() { GeneralResult result = proxy.ReportTCResult(tcIdToHaveResults, tPlanId, TestCaseResultStatus.Blocked, platformId); Console.WriteLine("Status: '{0}', message: '{1}'", result.status, result.message); Assert.AreEqual(true, result.status); }
public async Task <GeneralResult <IList <long> > > Validate(ICollection <OrderXmlModel> orders) { var result = new GeneralResult <IList <long> >() { Error = new List <long>(), IsSuccess = true }; foreach (var order in orders) { var isExist = await orderRepository.GetAll().AnyAsync(o => o.OxId == order.Id); if (isExist) { result.Error.Add(order.Id); result.IsSuccess = false; } } if (!result.IsSuccess) { result.Message = $"Orders already exists"; result.ErrorCode = Common.Enums.ErrorCode.OrderIsDublicated; } return(result); }
public void Read_ValidEntityWithStochasts_ReturnsGeneralResultFaultTreeIllustrationPoint() { // Setup var random = new Random(21); var entity = new GeneralResultFaultTreeIllustrationPointEntity { GoverningWindDirectionName = "SSE", GoverningWindDirectionAngle = random.NextDouble(), StochastEntities = new[] { new StochastEntity { Name = "stochastEntityOne", Duration = random.NextDouble(), Alpha = random.NextDouble(), Order = 0 }, new StochastEntity { Name = "stochastEntityTwo", Duration = random.NextDouble(), Alpha = random.NextDouble(), Order = 1 } } }; // Call GeneralResult <TopLevelFaultTreeIllustrationPoint> generalResult = entity.Read(); // Assert AssertWindDirection(entity, generalResult.GoverningWindDirection); AssertStochasts(entity.StochastEntities.ToArray(), generalResult.Stochasts.ToArray()); }
/// <summary> /// Parses the illustration point database results. /// </summary> /// <param name="reader">The database reader.</param> /// <exception cref="HydraRingFileParserException">Thrown when parsing the results from <paramref name="reader"/>.</exception> private void ParseResultsFromReader(HydraRingDatabaseReader reader) { ParseClosingSituations(reader); ProceedOrThrow(reader); ParseWindDirections(reader); ProceedOrThrow(reader); ParseSubMechanisms(reader); ProceedOrThrow(reader); ParseFaultTrees(reader); ProceedOrThrow(reader); ParseGeneralAlphaValues(reader); ProceedOrThrow(reader); ParseGeneralBetaValue(reader); ProceedOrThrow(reader); ParseFaultTreeAlphaValues(reader); ProceedOrThrow(reader); ParseFaultTreeBetaValues(reader); ProceedOrThrow(reader); ParseSubMechanismAlphaValues(reader); ProceedOrThrow(reader); ParseSubMechanismBetaValues(reader); ProceedOrThrow(reader); ParseSubMechanismResults(reader); ProceedOrThrow(reader); Dictionary <WindDirectionClosingSituation, IllustrationPointTreeNode> rootIllustrationPoints = ParseFaultTree(reader) ?? GetSubMechanismAsRootIllustrationPoint(); Output = new GeneralResult(beta, governingWindDirection, stochasts, rootIllustrationPoints); }
/// <summary> /// get a test case id. If the test case does not exist then create one /// </summary> /// <param name="testName"></param> /// <param name="testSuiteId"></param> /// <param name="authorId"></param> /// <param name="projectId"></param> /// <returns>a valid test case id or 0 in case of failure</returns> private int getTestCaseId(string testName, int testSuiteId, string authorId, int projectId, int testPlanId) { int TCaseId = getTestCaseByName(testName, testSuiteId); if (TCaseId == 0) { // need to create test case GeneralResult result = proxy.CreateTestCase(authorId, testSuiteId, testName, projectId, "Automated TestCase", "", 0, true, ActionOnDuplicatedName.Block, 2, 2); TCaseId = result.additionalInfo.id; int tcExternalId = result.additionalInfo.external_id; if (result.status == false) { Console.Error.WriteLine("Failed to create TestCase for {0}", testName); Console.Error.WriteLine(" Reason {0}", result.message); return(0); } string externalId = string.Format("{0}-{1}", currentProject.prefix, tcExternalId); int featureId = proxy.addTestCaseToTestPlan(currentProject.id, testPlanId, externalId, result.additionalInfo.version_number); if (featureId == 0) { Console.Error.WriteLine("Failed to assign TestCase {0} to testplan", testName); return(0); } } return(TCaseId); }
public void Clone_Always_ReturnNewInstanceWithCopiedValues() { // Setup var random = new Random(21); var original = new GeneralResult <TopLevelIllustrationPointBase>(WindDirectionTestFactory.CreateTestWindDirection(), new[] { new Stochast("Random name 1", random.NextDouble(), random.NextDouble()), new Stochast("Random name 2", random.NextDouble(), random.NextDouble()) }, new[] { new TestTopLevelIllustrationPoint("situation 1"), new TestTopLevelIllustrationPoint("situation 2") }); // Call object clone = original.Clone(); // Assert CoreCloneAssert.AreObjectClones(original, clone, CommonCloneAssert.AreClones); }
/// <summary> /// Gets the table list detail definition configuration based in the parameters. /// </summary> /// <param name="parameters">The parameters.</param> /// <returns></returns> /// <exception cref="ALexException">Used for displaying a message to the user.</exception> /// <exception cref="QueryBuilderException">Thrown with a code number.</exception> public virtual async Task <GeneralResult <DetailListConfigViewModel> > GetDetailListConfigAsync(IBuilderParameters parameters) { GeneralResult <DetailListConfigViewModel> result; try { var r = await(from td in base.GetTableDefinitions(parameters) select new DetailListConfigViewModel() { DetailFormat = td.TableDefinitionUi.DetailFormat, DisplayName = td.TableDefinitionUi.DisplayName, ItemName = td.ItemName, }).FirstOrDefaultAsync(); r.Groups = await(from f in base.GetFieldDefinitions(parameters) select new FieldConfigViewModel() { DisplayFormat = f.FieldDefinitionUi.DisplayFormat, ItemName = f.ItemName }).ToListAsync(); result = new GeneralResult <DetailListConfigViewModel>() { Result = r }; } catch (ALexException ex) { result = base.GetResultFromException <GeneralResult <DetailListConfigViewModel> >(ex, 2002); } return(result); }
public void CreatePlan() { string planName = string.Format("AutocreatedTestPlan at {0}", DateTime.Now.ToUniversalTime()); Assert.AreNotEqual(-1, ApiTestProjectId); Console.WriteLine("Creating Testplan for TestProjectId = {0}", ApiTestProjectId); GeneralResult createResult = proxy.CreateTestPlan(planName, ApiTestProject.name, "These are some notes", true); Console.WriteLine("Result status:{0}, id:{1}, message:'{2}'", createResult.status, createResult.id, createResult.message); Assert.AreEqual(true, createResult.status, "Create did not return true"); List <TestPlan> result = proxy.GetProjectTestPlans(ApiTestProjectId); bool found = false; foreach (TestPlan plan in result) { Console.Write("Looking at plan id:{0} '{1}'", plan.id, plan.name); if (plan.id == createResult.id) { found = true; Console.WriteLine(" --- Found!"); Assert.AreEqual(true, plan.active, "Plan should be active"); Assert.AreEqual(planName, plan.name, "Plan name is wrong"); break; } else { Console.WriteLine(" --- no match"); } } Assert.IsTrue(found, "No plan created"); }
/// <summary> /// Creates a new instance of <see cref="TestHydraulicLoadsOutput"/>. /// </summary> /// <param name="targetProbability">The target probability used during the calculation.</param> /// <param name="targetReliability">The reliability index used during the calculation.</param> /// <param name="calculatedProbability">The calculated probability.</param> /// <param name="calculatedReliability">The calculated reliability index.</param> /// <param name="calculationConvergence">The convergence status of the calculation.</param> /// <param name="generalResult">The general result with the fault tree illustration points.</param> /// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="targetProbability"/> /// or <paramref name="calculatedProbability"/> falls outside the [0.0, 1.0] range and is not <see cref="double.NaN"/>.</exception> public TestHydraulicLoadsOutput(double targetProbability, double targetReliability, double calculatedProbability, double calculatedReliability, CalculationConvergence calculationConvergence, GeneralResult <TopLevelFaultTreeIllustrationPoint> generalResult) : base(targetProbability, targetReliability, calculatedProbability, calculatedReliability, calculationConvergence, generalResult) { }
public void GivenFullyConfiguredView_WhenSelectingCellInRow_ThenSelectionChangedAndPropagatedAccordingly() { // Given var mocks = new MockRepository(); var calculation = mocks.Stub <ICalculation>(); mocks.ReplayAll(); GeneralResult <TopLevelSubMechanismIllustrationPoint> generalResult = GetGeneralResultWithTwoTopLevelIllustrationPoints(); var view = new GeneralResultSubMechanismIllustrationPointView(calculation, () => generalResult); ShowTestView(view); var selectionChangedCount = 0; view.SelectionChanged += (sender, args) => selectionChangedCount++; DataGridView dataGridView = ControlTestHelper.GetDataGridView(testForm, "DataGridView"); // When dataGridView.CurrentCell = dataGridView.Rows[1].Cells[0]; EventHelper.RaiseEvent(dataGridView, "CellClick", new DataGridViewCellEventArgs(0, 0)); // Then Assert.AreEqual(1, selectionChangedCount); TopLevelSubMechanismIllustrationPoint[] topLevelIllustrationPoints = generalResult.TopLevelIllustrationPoints.ToArray(); TopLevelSubMechanismIllustrationPoint topLevelIllustrationPoint = topLevelIllustrationPoints.ElementAt(1); AssertIllustrationPointSelection(topLevelIllustrationPoint, topLevelIllustrationPoints.Select(ip => ip.ClosingSituation), view.Selection); mocks.VerifyAll(); }
/// <summary> /// Creates a random instance of <see cref="StructuresOutput"/>. /// </summary> /// <param name="generalResult">The general result to set to the output.</param> /// <returns>A random instance of <see cref="StructuresOutput"/>.</returns> public static StructuresOutput GetRandomStructuresOutput(GeneralResult <TopLevelFaultTreeIllustrationPoint> generalResult) { var random = new Random(21); return(new StructuresOutput(random.NextDouble(), generalResult)); }
public void createAUniqueTestCase() { string uniqueName = string.Format("unitTest created at {0}", DateTime.Now); TestStep[] steps = new TestStep[3]; steps[0] = new TestStep(1, "<p>Step 1</p>", "<p>result 1</p>", true, 1); steps[1] = new TestStep(2, "<p>Step 2</p>", "<p>result 2</p>", true, 1); steps[2] = new TestStep(3, "<p>Step 3</p>", "<p>result 3</p>", true, 1); GeneralResult result = proxy.CreateTestCase(userName, BusinessRulesTestSuiteId, uniqueName, ApiTestProjectId, "This is a summary", steps, "auto,positive", 0, true, ActionOnDuplicatedName.CreateNewVersion, 2, 2); Assert.AreEqual(true, result.status); Assert.AreEqual("Success!", result.message); Assert.AreEqual("createTestCase", result.operation); Assert.AreEqual("", result.additionalInfo.new_name); Assert.AreEqual(true, result.additionalInfo.status_ok); Assert.AreEqual("ok", result.additionalInfo.msg); Assert.AreEqual(1, result.additionalInfo.version_number); Assert.AreEqual(false, result.additionalInfo.has_duplicate); }
/// <summary> /// Method that asserts whether <paramref name="original"/> and <paramref name="clone"/> /// are clones. /// </summary> /// <param name="original">The original object.</param> /// <param name="clone">The cloned object.</param> /// <exception cref="AssertionException">Thrown when <paramref name="original"/> and /// <paramref name="clone"/> are not clones.</exception> /// <typeparam name="T">The type of the top level illustration point.</typeparam> public static void AreClones <T>(GeneralResult <T> original, GeneralResult <T> clone) where T : TopLevelIllustrationPointBase { CoreCloneAssert.AreObjectClones(original.GoverningWindDirection, clone.GoverningWindDirection, AreClones); CoreCloneAssert.AreEnumerationClones(original.Stochasts, clone.Stochasts, AreClones); CoreCloneAssert.AreEnumerationClones(original.TopLevelIllustrationPoints, clone.TopLevelIllustrationPoints, AreClones); }
public void Constructor_ExpectedValues(bool withIllustrationPoints) { // Setup const double waveHeight = 3.2934; const double reliability = 0.1; GeneralResult <TopLevelFaultTreeIllustrationPoint> generalResult = withIllustrationPoints ? new TestGeneralResultFaultTreeIllustrationPoint() : null; // Call var output = new OvertoppingOutput(waveHeight, true, reliability, generalResult); // Assert Assert.IsInstanceOf <ICloneable>(output); Assert.AreEqual(2, output.WaveHeight.NumberOfDecimalPlaces); Assert.AreEqual(waveHeight, output.WaveHeight, output.WaveHeight.GetAccuracy()); Assert.IsTrue(output.IsOvertoppingDominant); Assert.AreEqual(reliability, output.Reliability); Assert.IsTrue(output.HasWaveHeight); Assert.AreEqual(withIllustrationPoints, output.HasGeneralResult); Assert.AreSame(generalResult, output.GeneralResult); }
public void CreateGeneralResultSubMechanismIllustrationPointEntity_ValidGeneralResultWithIllustrationPoints_ReturnsEntityWithTopLevelSubMechanismIllustrationPointEntities() { // Setup var random = new Random(21); var generalResult = new GeneralResult <TopLevelSubMechanismIllustrationPoint>( new WindDirection("SSE", random.NextDouble()), Enumerable.Empty <SubMechanismIllustrationPointStochast>(), new[] { new TopLevelSubMechanismIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(), "IllustrationPointOne", new TestSubMechanismIllustrationPoint()), new TopLevelSubMechanismIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(), "IllustrationPointTwo", new TestSubMechanismIllustrationPoint()) }); // Call GeneralResultSubMechanismIllustrationPointEntity entity = generalResult.CreateGeneralResultSubMechanismIllustrationPointEntity(); // Assert AssertGeneralResultSubMechanismIllustrationPointEntity(generalResult, entity); }
public void GivenViewWithIllustrationPoints_WhenIllustrationPointsCleared_ThenControlsSyncedAccordingly() { // Given var returnGeneralResult = true; var calculation = new TestCalculation(); GeneralResult <TopLevelFaultTreeIllustrationPoint> generalResult = GetGeneralResultWithTwoTopLevelIllustrationPoints(); var view = new GeneralResultFaultTreeIllustrationPointView(calculation, () => returnGeneralResult ? generalResult : null); ShowTestView(view); // Precondition IllustrationPointsControl illustrationPointsControl = GetIllustrationPointsControl(view); IllustrationPointsFaultTreeControl illustrationPointsFaultTreeControl = GetIllustrationPointsFaultTreeControl(view); AssertIllustrationPointControlItems(generalResult, illustrationPointsControl); Assert.AreSame(generalResult.TopLevelIllustrationPoints.First(), illustrationPointsFaultTreeControl.Data); // When returnGeneralResult = false; calculation.NotifyObservers(); // Then CollectionAssert.IsEmpty(illustrationPointsControl.Data); Assert.IsNull(illustrationPointsFaultTreeControl.Data); }
public void ConvertToGeneralResultTopLevelFaultTreeIllustrationPoint_HydraRingGeneralResultWithFaultTreeIllustrationPointsOnly_ExpectedProperties() { // Setup var random = new Random(21); const string closingSituation = "Closing situation"; var hydraRingWindDirection = new HydraRingWindDirection("SSE", random.NextDouble()); var hydraRingWindDirectionClosingSituation = new HydraRingWindDirectionClosingSituation( hydraRingWindDirection, closingSituation); var hydraRingIllustrationPoint = new HydraRingFaultTreeIllustrationPoint( "IllustrationPoint", random.NextDouble(), Enumerable.Empty <HydraRingStochast>(), HydraRingCombinationType.Or); var hydraRingIllustrationTreeNode = new HydraRingIllustrationPointTreeNode(hydraRingIllustrationPoint); var governingHydraRingWindDirection = new HydraRingWindDirection("Name", random.NextDouble()); var hydraRingGeneralResult = new HydraRingGeneralResult( random.NextDouble(), governingHydraRingWindDirection, Enumerable.Empty <HydraRingStochast>(), new Dictionary <HydraRingWindDirectionClosingSituation, HydraRingIllustrationPointTreeNode> { { hydraRingWindDirectionClosingSituation, hydraRingIllustrationTreeNode } }); // Call GeneralResult <TopLevelFaultTreeIllustrationPoint> generalResult = GeneralResultConverter.ConvertToGeneralResultTopLevelFaultTreeIllustrationPoint(hydraRingGeneralResult); // Assert WindDirection generalResultGoverningWindDirection = generalResult.GoverningWindDirection; AssertWindDirection(governingHydraRingWindDirection, generalResultGoverningWindDirection); TopLevelFaultTreeIllustrationPoint topLevelFaultTreeIllustrationPoint = generalResult.TopLevelIllustrationPoints.Single(); AssertWindDirection(hydraRingWindDirection, topLevelFaultTreeIllustrationPoint.WindDirection); Assert.AreEqual(closingSituation, topLevelFaultTreeIllustrationPoint.ClosingSituation); IllustrationPointNode faultTreeIllustrationPoint = topLevelFaultTreeIllustrationPoint.FaultTreeNodeRoot; CollectionAssert.IsEmpty(faultTreeIllustrationPoint.Children); var faultTreeIllustrationPointData = (FaultTreeIllustrationPoint)faultTreeIllustrationPoint.Data; CollectionAssert.IsEmpty(faultTreeIllustrationPointData.Stochasts); Assert.AreEqual(hydraRingIllustrationPoint.Name, faultTreeIllustrationPointData.Name); Assert.AreEqual(hydraRingIllustrationPoint.Beta, faultTreeIllustrationPointData.Beta, faultTreeIllustrationPointData.Beta.GetAccuracy()); Assert.AreEqual(CombinationType.Or, faultTreeIllustrationPointData.CombinationType); }
/// <summary> /// Creates a random instance of <see cref="PartialProbabilisticPipingOutput{T}"/> /// with <see cref="TestTopLevelIllustrationPoint"/>. /// </summary> /// <param name="generalResult">The general result to set to the output.</param> /// <returns>The created <see cref="PartialProbabilisticPipingOutput{T}"/>.</returns> public static PartialProbabilisticPipingOutput <TestTopLevelIllustrationPoint> GetRandomPartialProbabilisticPipingOutput( GeneralResult <TestTopLevelIllustrationPoint> generalResult) { var random = new Random(21); return(new TestPartialProbabilisticPipingOutput(random.NextDouble(), generalResult)); }
public void ShouldRejectBecauseOfInvalidData() { string tcName = "externally created test case"; GeneralResult result = proxy.CreateTestCase(userName, BusinessRulesTestSuiteId, tcName, 0, "This is a summary for an externally created test case", "auto,positive", 0, true, ActionOnDuplicatedName.GenerateNew, 2, 2); }
/// <summary> /// Creates a new instance of <see cref="OvertoppingRateOutput"/>. /// </summary> /// <param name="overtoppingRate">The calculated overtopping rate.</param> /// <param name="targetProbability">The target probability used during the calculation.</param> /// <param name="targetReliability">The reliability index used during the calculation.</param> /// <param name="calculatedProbability">The calculated probability.</param> /// <param name="calculatedReliability">The calculated reliability index.</param> /// <param name="calculationConvergence">The convergence status of the calculation.</param> /// <param name="generalResult">The general result with illustration points belonging to /// this output.</param> /// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="targetProbability"/> /// or <paramref name="calculatedProbability"/> falls outside the [0.0, 1.0] range and is not <see cref="double.NaN"/>.</exception> public OvertoppingRateOutput(double overtoppingRate, double targetProbability, double targetReliability, double calculatedProbability, double calculatedReliability, CalculationConvergence calculationConvergence, GeneralResult <TopLevelFaultTreeIllustrationPoint> generalResult) : base(targetProbability, targetReliability, calculatedProbability, calculatedReliability, calculationConvergence, generalResult) { OvertoppingRate = new RoundedDouble(5, overtoppingRate); }
/// <summary> /// Creates a random instance of <see cref="PartialProbabilisticSubMechanismPipingOutput"/> /// with <see cref="TopLevelSubMechanismIllustrationPoint"/>. /// </summary> /// <param name="generalResult">The <see cref="GeneralResult{T}"/> to set to the output.</param> /// <returns>The created <see cref="PartialProbabilisticSubMechanismPipingOutput"/>.</returns> public static PartialProbabilisticSubMechanismPipingOutput GetRandomPartialProbabilisticSubMechanismPipingOutput( GeneralResult <TopLevelSubMechanismIllustrationPoint> generalResult) { var random = new Random(21); return(new PartialProbabilisticSubMechanismPipingOutput(random.NextDouble(), generalResult)); }
public void CreateABuild() { GeneralResult result = proxy.CreateBuild(PlanCalledAutomatedTesting.id, string.Format("build {0}", DateTime.Now), "an auto created build"); Assert.IsNotNull(result, "Returned a null result"); Assert.IsTrue(result.status == true, "CreateBuild returned failure: {0}", result.message); }