public void Create_WithValidData_ReturnsPersistableProjectInfo() { // Setup MacroStabilityInwardsCalculationScenario calculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(new TestHydraulicBoundaryLocation()); const string filePath = "SomeFilePath"; // Call PersistableProjectInfo persistableProjectInfo = PersistableProjectInfoFactory.Create(calculation, filePath); // Assert PersistableDataModelTestHelper.AssertProjectInfo(calculation, filePath, persistableProjectInfo); }
/// <summary> /// Asserts whether the <see cref="PersistableProjectInfo"/> contains the data /// that is representative for the <paramref name="calculation"/> /// and the <paramref name="filePath"/>. /// </summary> /// <param name="calculation">The calculation that contains the original data.</param> /// <param name="filePath">The file path that is used.</param> /// <param name="persistableProjectInfo">The <see cref="PersistableProjectInfo"/> that needs to be asserted.</param> /// <exception cref="AssertionException">Thrown when the data in <paramref name="persistableProjectInfo"/> /// is not correct.</exception> public static void AssertProjectInfo(MacroStabilityInwardsCalculation calculation, string filePath, PersistableProjectInfo persistableProjectInfo) { Assert.AreEqual(filePath, persistableProjectInfo.Path); Assert.AreEqual(calculation.Name, persistableProjectInfo.Project); Assert.AreEqual(calculation.InputParameters.SurfaceLine.Name, persistableProjectInfo.CrossSection); Assert.AreEqual($"Riskeer {AssemblyUtils.GetAssemblyInfo(Assembly.GetAssembly(typeof(PersistableDataModelTestHelper))).Version}", persistableProjectInfo.ApplicationCreated); Assert.AreEqual("Export from Riskeer", persistableProjectInfo.Remarks); Assert.IsNotNull(persistableProjectInfo.Created); Assert.IsNull(persistableProjectInfo.Date); Assert.IsNull(persistableProjectInfo.LastModified); Assert.IsNull(persistableProjectInfo.LastModifier); Assert.IsNull(persistableProjectInfo.Analyst); Assert.IsTrue(persistableProjectInfo.IsDataValidated); }