Analisys manager window was added

This commit is contained in:
RedikultsevEvg
2024-08-20 20:38:01 +05:00
parent 45dbd7a1ca
commit c1b9f80a96
50 changed files with 1036 additions and 281 deletions

View File

@@ -85,6 +85,11 @@
<Setter Property="BorderBrush" Value="Black"/>
</Style>
<Style x:Key="ToolButton24" TargetType="Button" BasedOn="{StaticResource ToolButton}">
<Setter Property="Height" Value="24"/>
<Setter Property="Width" Value="24"/>
</Style>
<Style x:Key="ButtonImage16" TargetType="Image">
<Setter Property="Height" Value="16"/>
<Setter Property="Width" Value="16"/>
@@ -218,4 +223,108 @@
</Canvas>
</DataTemplate>
<DataTemplate x:Key="FileOpen">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<Path Margin="4" Data="M 2 6 l 8 0 l 3 3 l 6 0 l 0 12 l -17 0 z" Fill="DarkGray" Stroke="Black" StrokeThickness="1"/>
<Path Margin="4" Data="M 6 12 l 20 0 l -5 10 l -19 0 z" Fill="LightGray" Stroke="Black" StrokeThickness="1"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="FileSave">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<Rectangle Height="26" Width="26" Canvas.Left="3" Canvas.Top="3"
Fill="DarkGray" Stroke="Black" StrokeThickness="1"
RadiusX="2" RadiusY="2"/>
<Rectangle Height="8" Width="12" Canvas.Left="10" Canvas.Top="4"
Fill="LightGray" Stroke="Black" StrokeThickness="0.5"/>
<Rectangle Height="6" Width="4" Canvas.Left="16" Canvas.Top="5"
Fill="DarkGray" Stroke="Black" StrokeThickness="0.5"/>
<Rectangle Height="14" Width="22" Canvas.Left="5" Canvas.Top="13"
Fill="LightGray" Stroke="Black" StrokeThickness="0.5"
RadiusX="2" RadiusY="2"/>
<Line X1="7" Y1="18" X2="24" Y2="18" Stroke="Black" StrokeThickness="0.5"/>
<Line X1="7" Y1="21" X2="24" Y2="21" Stroke="Black" StrokeThickness="0.5"/>
<Line X1="7" Y1="24" X2="24" Y2="24" Stroke="Black" StrokeThickness="0.5"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="Diagrams">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<Line X1="2" Y1="16" X2="30" Y2="16" Stroke="Black" StrokeThickness="0.5"/>
<Line X1="16" Y1="2" X2="16" Y2="30" Stroke="Black" StrokeThickness="0.5"/>
<Path Margin="2" Data="M 0 21 l 6 0 l 9 -8 l 9 -8 l 4 0" Stroke="Black" StrokeThickness="1"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="NdmCrossSection">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<Rectangle Height="16" Width="8" Canvas.Left="12" Canvas.Top="12"
Fill="DarkGray" Stroke="Black" StrokeThickness="1"/>
<Rectangle Height="6" Width="16" Canvas.Left="8" Canvas.Top="7"
Fill="LightGray" Stroke="Black" StrokeThickness="1"/>
<Line X1="2" Y1="16" X2="30" Y2="16" Stroke="Black" StrokeThickness="0.5"/>
<Line X1="16" Y1="2" X2="16" Y2="30" Stroke="Black" StrokeThickness="0.5"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="SelectAll">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<CheckBox Canvas.Left="13" Canvas.Top="13" IsChecked="True"/>
<CheckBox Canvas.Left="2" Canvas.Top="2" IsChecked="True"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="DeSelectAll">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<CheckBox Canvas.Left="13" Canvas.Top="13" IsChecked="False"/>
<CheckBox Canvas.Left="2" Canvas.Top="2" IsChecked="False"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="InvertSelection">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<CheckBox Canvas.Left="13" Canvas.Top="13" IsChecked="True"/>
<CheckBox Canvas.Left="2" Canvas.Top="2" IsChecked="False"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="RunAnalisis">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<Path Margin="4" Data="M 4 2 l 12 10 l -12 10 z" Fill="DarkGray" Stroke="Black" StrokeThickness="1"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="EditAnalisis">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<Path Margin="4" Data="M 2 22 l 4 -6 l 15 -16 l 4 4 l -15 14 z" Fill="DarkGray" Stroke="Black" StrokeThickness="1"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="DeleteAnalisis">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<Line X1="4" Y1="4" X2="26" Y2="26" Stroke="Black" StrokeThickness="2"/>
<Line X1="4" Y1="26" X2="26" Y2="4" Stroke="Black" StrokeThickness="2"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
</ResourceDictionary>

View File

@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<History>True|2024-03-11T15:33:14.1457807Z;True|2024-03-10T19:11:27.6834663+05:00;True|2024-02-02T12:22:50.1454015+05:00;True|2023-02-25T13:37:39.2738786+05:00;False|2023-02-25T13:37:24.0284261+05:00;True|2023-02-25T13:34:01.6858860+05:00;True|2023-02-25T13:31:18.8295711+05:00;False|2023-02-25T13:25:21.5807199+05:00;False|2023-02-25T13:24:41.7164398+05:00;</History>
<History>True|2024-08-13T09:00:35.8311260Z||;True|2024-08-12T12:59:16.1785759+05:00||;True|2024-03-11T20:33:14.1457807+05:00||;True|2024-03-10T19:11:27.6834663+05:00||;True|2024-02-02T12:22:50.1454015+05:00||;True|2023-02-25T13:37:39.2738786+05:00||;False|2023-02-25T13:37:24.0284261+05:00||;True|2023-02-25T13:34:01.6858860+05:00||;True|2023-02-25T13:31:18.8295711+05:00||;False|2023-02-25T13:25:21.5807199+05:00||;False|2023-02-25T13:24:41.7164398+05:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_LastSelectedProfileId>C:\Source\Repos\StructureHelper\StructureHelper\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
<_LastSelectedProfileId>C:\Repos\StructureHelper\StructureHelper\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
</PropertyGroup>
<ItemGroup>
<ApplicationDefinition Update="App.xaml">
@@ -60,6 +60,9 @@
<Compile Update="Windows\MainWindow\AboutView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\MainWindow\AnalisesManagerView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\MainWindow\Materials\HeadMaterialView.xaml.cs">
<SubType>Code</SubType>
</Compile>
@@ -152,6 +155,9 @@
<Page Update="Windows\MainWindow\AboutView.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\MainWindow\AnalisesManagerView.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\MainWindow\Materials\HeadMaterialView.xaml">
<SubType>Designer</SubType>
</Page>

View File

@@ -15,7 +15,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
public class CrackCalculatorInputDataViewModel : OkCancelViewModelBase
{
private CrackCalculator calculator;
CrackCalculatorInputData crackInputData;
ICrackCalculatorInputData crackInputData;
private bool setUserValueSofteningFactor;
private double softeningFactor;
private string name;

View File

@@ -0,0 +1,13 @@
using StructureHelper.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.MainWindow
{
public class AnalisesLogic : ViewModelBase
{
}
}

View File

@@ -0,0 +1,103 @@
<Window x:Class="StructureHelper.Windows.MainWindow.AnalisesManagerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:StructureHelper.Windows.MainWindow"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance local:AnalisesManagerViewModel}"
Title="Analises Manager" Height="450" Width="800" MinHeight="400" MinWidth="600">
<Grid>
<DockPanel>
<ToolBarTray DockPanel.Dock="Top">
<ToolBar DataContext="{Binding FileLogic}" ToolTip="File">
<Button Style="{StaticResource ToolButton}"
Command="{Binding Add}" ToolTip="Open file">
<Viewbox>
<ContentControl ContentTemplate="{DynamicResource FileOpen}"/>
</Viewbox>
</Button>
<Button Style="{StaticResource ToolButton}"
Command="{Binding Add}" ToolTip="Save file">
<Viewbox>
<ContentControl ContentTemplate="{DynamicResource FileSave}"/>
</Viewbox>
</Button>
</ToolBar>
<ToolBar ToolTip="Diagrams">
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" ToolTip="Diagrams">
<Viewbox>
<ContentControl ContentTemplate="{DynamicResource Diagrams}"/>
</Viewbox>
</Button>
</ToolBar>
<ToolBar ToolTip="Cross-sections">
<Button Style="{DynamicResource ToolButton}" Command="{Binding Add}" ToolTip="NDM Analisis">
<Viewbox>
<ContentControl ContentTemplate="{DynamicResource NdmCrossSection}"/>
</Viewbox>
</Button>
</ToolBar>
</ToolBarTray>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ToolBar HorizontalAlignment="Right">
<Button Style="{StaticResource ToolButton24}" Command="{Binding Add}" ToolTip="Select all">
<Viewbox Width="24" Height="24">
<ContentControl ContentTemplate="{DynamicResource SelectAll}"/>
</Viewbox>
</Button>
<Button Style="{StaticResource ToolButton24}" Command="{Binding Add}" ToolTip="DeSelect all">
<Viewbox Width="24" Height="24">
<ContentControl ContentTemplate="{DynamicResource DeSelectAll}"/>
</Viewbox>
</Button>
<Button Style="{StaticResource ToolButton24}" Command="{Binding Add}" ToolTip="Inver Selection">
<Viewbox Width="24" Height="24">
<ContentControl ContentTemplate="{DynamicResource InvertSelection}"/>
</Viewbox>
</Button>
</ToolBar>
<ListBox Grid.Row="1" MinWidth="200">
</ListBox>
</Grid>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ToolBar HorizontalAlignment="Right">
<Button Style="{StaticResource ToolButton24}" Command="{Binding Add}" ToolTip="Select all">
<Viewbox Width="24" Height="24">
<ContentControl ContentTemplate="{DynamicResource RunAnalisis}"/>
</Viewbox>
</Button>
<Button Style="{StaticResource ToolButton24}" Command="{Binding Add}" ToolTip="Select all">
<Viewbox Width="24" Height="24">
<ContentControl ContentTemplate="{DynamicResource EditAnalisis}"/>
</Viewbox>
</Button>
<Button Style="{StaticResource ToolButton24}" Command="{Binding Add}" ToolTip="Select all">
<Viewbox Width="24" Height="24">
<ContentControl ContentTemplate="{DynamicResource DeleteAnalisis}"/>
</Viewbox>
</Button>
</ToolBar>
<ListBox Grid.Row="1">
</ListBox>
</Grid>
</Grid>
</DockPanel>
</Grid>
</Window>

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace StructureHelper.Windows.MainWindow
{
/// <summary>
/// Логика взаимодействия для AnalisesManagerView.xaml
/// </summary>
public partial class AnalisesManagerView : Window
{
public AnalisesManagerView()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,23 @@
using StructureHelper.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.MainWindow
{
public class AnalisesManagerViewModel : ViewModelBase
{
public FileLogic FileLogic { get; }
public DiagramLogic DiagramLogic { get; }
public AnalisesLogic AnalisesLogic { get; }
public AnalisesManagerViewModel()
{
FileLogic = new();
DiagramLogic = new();
AnalisesLogic = new();
}
}
}

View File

@@ -0,0 +1,13 @@
using StructureHelper.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.MainWindow
{
public class DiagramLogic : ViewModelBase
{
}
}

View File

@@ -0,0 +1,19 @@
using StructureHelper.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace StructureHelper.Windows.MainWindow
{
public class FileLogic : ViewModelBase
{
private ICommand fileOpen;
private ICommand fileSave;
public ICommand FileOpen => fileOpen;
public ICommand FileSave => fileSave;
}
}

View File

@@ -60,11 +60,12 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
private void AddCrackCalculator()
{
var inputData = new CrackCalculatorInputData();
var calculator = new CrackCalculator(inputData)
var calculator = new CrackCalculator()
{
Name = "New crack calculator",
TraceLogger = new ShiftTraceLogger(),
};
calculator.InputData = inputData;
NewItem = calculator;
}

View File

@@ -10,11 +10,19 @@ namespace StructureHelperCommon.Models.Forces
{
public class FactorCombinationUpdateStrategy : IUpdateStrategy<IForceCombinationByFactor>
{
readonly IUpdateStrategy<IForceTuple> tupleUpdateStrategy = new ForceTupleUpdateStrategy();
private IUpdateStrategy<IForceTuple> tupleUpdateStrategy;
public FactorCombinationUpdateStrategy(IUpdateStrategy<IForceTuple> tupleUpdateStrategy)
{
this.tupleUpdateStrategy = tupleUpdateStrategy;
}
public FactorCombinationUpdateStrategy() : this(new ForceTupleUpdateStrategy())
{
}
public void Update(IForceCombinationByFactor targetObject, IForceCombinationByFactor sourceObject)
{
if (ReferenceEquals(targetObject, sourceObject)) { return; }
CheckObject.CompareTypes(targetObject, sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
tupleUpdateStrategy.Update(targetObject.FullSLSForces, sourceObject.FullSLSForces);
targetObject.ULSFactor = sourceObject.ULSFactor;
targetObject.LongTermFactor = sourceObject.LongTermFactor;

View File

@@ -25,7 +25,7 @@ namespace StructureHelperCommon.Services
public static void CompareTypes(object targetObject, object sourceObject)
{
IsNull(targetObject, "target object");
IsNull(targetObject, "source object");
IsNull(sourceObject, "source object");
if (targetObject.GetType() != sourceObject.GetType())
{
throw new StructureHelperException
@@ -34,7 +34,10 @@ namespace StructureHelperCommon.Services
}
public static void IsNull(object item, string message = "")
{
if (item is null) { throw new StructureHelperException(ErrorStrings.ParameterIsNull + message); }
if (item is null)
{
throw new StructureHelperException(ErrorStrings.ParameterIsNull + ": "+ message);
}
}
public static void CheckType(object sourceObject, Type targetType)

View File

@@ -21,7 +21,7 @@ namespace StructureHelperLogics.Models.Materials
/// <inheritdoc/>
public ILibMaterialEntity MaterialEntity { get; set; }
/// <inheritdoc/>
public List<IMaterialSafetyFactor> SafetyFactors { get; }
public List<IMaterialSafetyFactor> SafetyFactors { get; set; }
/// <inheritdoc/>
public bool TensionForULS { get ; set; }
/// <inheritdoc/>

View File

@@ -1,5 +1,6 @@
using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Infrastructures.Settings;
using StructureHelperCommon.Models.Materials.Libraries;
using System;
@@ -14,6 +15,7 @@ namespace StructureHelperLogics.Models.Materials
{
private IElasticMaterialLogic elasticMaterialLogic => new ElasticMaterialLogic();
private MaterialTypes materialType;
IUpdateStrategy<IFRMaterial> fRUpdateStrategy = new FRUpdateStrategy();
public double Modulus{ get; set; }
public double CompressiveStrength { get; set; }
public double TensileStrength { get; set; }
@@ -49,7 +51,7 @@ namespace StructureHelperLogics.Models.Materials
public object Clone()
{
var newItem = new FRMaterial(this.materialType);
var updateStrategy = new FRUpdateStrategy();
var updateStrategy = fRUpdateStrategy;
updateStrategy.Update(newItem, this);
return newItem;
}

View File

@@ -11,7 +11,7 @@ namespace StructureHelperLogics.Models.Materials
public interface ILibMaterial : IHelperMaterial
{
ILibMaterialEntity MaterialEntity { get; set; }
List<IMaterialSafetyFactor> SafetyFactors { get; }
List<IMaterialSafetyFactor> SafetyFactors { get; set; }
IMaterialLogic MaterialLogic { get; set; }
List<IMaterialLogic> MaterialLogics { get; }
(double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm);

View File

@@ -23,7 +23,7 @@ namespace StructureHelperLogics.Models.Materials
public ILibMaterialEntity MaterialEntity { get; set; }
public List<IMaterialSafetyFactor> SafetyFactors { get; }
public List<IMaterialSafetyFactor> SafetyFactors { get; set; }
public IMaterialLogic MaterialLogic { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public List<IMaterialLogic> MaterialLogics => throw new NotImplementedException();

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -7,11 +8,20 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Materials
{
internal class ConcreteLibUpdateStrategy : IUpdateStrategy<IConcreteLibMaterial>
public class ConcreteLibUpdateStrategy : IUpdateStrategy<IConcreteLibMaterial>
{
LibMaterialUpdateStrategy libUpdateStrategy = new LibMaterialUpdateStrategy();
private IUpdateStrategy<ILibMaterial> libUpdateStrategy;
public ConcreteLibUpdateStrategy(IUpdateStrategy<ILibMaterial> libUpdateStrategy)
{
this.libUpdateStrategy = libUpdateStrategy;
}
public ConcreteLibUpdateStrategy() : this(new LibMaterialUpdateStrategy())
{
}
public void Update(IConcreteLibMaterial targetObject, IConcreteLibMaterial sourceObject)
{
CheckObject.CompareTypes(targetObject, sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
libUpdateStrategy.Update(targetObject, sourceObject);
targetObject.TensionForULS = sourceObject.TensionForULS;

View File

@@ -12,13 +12,15 @@ namespace StructureHelperLogics.Models.Materials
{
internal class ElasticMaterialLogic : IElasticMaterialLogic
{
private List<double> parameters;
public IMaterial GetLoaderMaterial(IElasticMaterial elasticMaterial, LimitStates limitState, CalcTerms calcTerm, double factor = 1d)
{
IMaterial material = new Material();
material.InitModulus = elasticMaterial.Modulus;
IFactorLogic factorLogic = new FactorLogic(elasticMaterial.SafetyFactors);
var factors = factorLogic.GetTotalFactor(limitState, calcTerm);
IEnumerable<double> parameters = new List<double>()
parameters = new List<double>()
{
elasticMaterial.Modulus,
elasticMaterial.CompressiveStrength * factors.Compressive * factor,
@@ -29,7 +31,7 @@ namespace StructureHelperLogics.Models.Materials
return material;
}
private double GetStressByStrain(IEnumerable<double> parameters, double strain)
private double GetStressByStrain(IEnumerable<double> parameters1, double strain)
{
double modulus = parameters.First();
double stress = modulus * strain;

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -12,6 +13,7 @@ namespace StructureHelperLogics.Models.Materials
{
public void Update(IElasticMaterial targetObject, IElasticMaterial sourceObject)
{
CheckObject.CompareTypes(targetObject, sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.Modulus = sourceObject.Modulus;
targetObject.CompressiveStrength = sourceObject.CompressiveStrength;

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -12,12 +13,13 @@ namespace StructureHelperLogics.Models.Materials
{
public void Update(IFRMaterial targetObject, IFRMaterial sourceObject)
{
CheckObject.ReferenceEquals(targetObject, sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.Modulus = sourceObject.Modulus;
targetObject.CompressiveStrength = sourceObject.CompressiveStrength;
targetObject.TensileStrength = targetObject.TensileStrength;
targetObject.ULSConcreteStrength = targetObject.ULSConcreteStrength;
targetObject.SumThickness = targetObject.SumThickness;
targetObject.TensileStrength = sourceObject.TensileStrength;
targetObject.ULSConcreteStrength = sourceObject.ULSConcreteStrength;
targetObject.SumThickness = sourceObject.SumThickness;
}
}
}

View File

@@ -1,5 +1,6 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Materials.Libraries;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -8,18 +9,23 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Materials
{
internal class LibMaterialUpdateStrategy : IUpdateStrategy<ILibMaterial>
public class LibMaterialUpdateStrategy : IUpdateStrategy<ILibMaterial>
{
public void Update(ILibMaterial targetObject, ILibMaterial sourceObject)
{
CheckObject.CompareTypes(targetObject, sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.MaterialEntity = sourceObject.MaterialEntity;
if (targetObject.SafetyFactors is not null & sourceObject.SafetyFactors is not null)
{
targetObject.SafetyFactors.Clear();
targetObject.MaterialLogic = sourceObject.MaterialLogic;
foreach (var item in sourceObject.SafetyFactors)
{
targetObject.SafetyFactors.Add(item.Clone() as IMaterialSafetyFactor);
}
}
targetObject.MaterialLogic = sourceObject.MaterialLogic;
}
}
}

View File

@@ -1,24 +1,37 @@
using StructureHelper.Models.Materials;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Materials
{
public class MaterialUpdateStrategy : IUpdateStrategy<IHeadMaterial>
{
private readonly IUpdateStrategy<IElasticMaterial> elasticStrategy = new ElasticUpdateStrategy();
private readonly IUpdateStrategy<IFRMaterial> frStrategy = new FRUpdateStrategy();
private readonly IUpdateStrategy<IConcreteLibMaterial> concreteStrategy = new ConcreteLibUpdateStrategy();
private readonly IUpdateStrategy<IReinforcementLibMaterial> reinforcementStrategy = new ReinforcementLibUpdateStrategy();
private IUpdateStrategy<IElasticMaterial> elasticStrategy;
private IUpdateStrategy<IFRMaterial> frStrategy;
private IUpdateStrategy<IConcreteLibMaterial> concreteStrategy;
private IUpdateStrategy<IReinforcementLibMaterial> reinforcementStrategy;
public MaterialUpdateStrategy(IUpdateStrategy<IElasticMaterial> elasticStrategy,
IUpdateStrategy<IFRMaterial> frStrategy,
IUpdateStrategy<IConcreteLibMaterial> concreteStrategy,
IUpdateStrategy<IReinforcementLibMaterial> reinforcementStrategy
)
{
this.elasticStrategy = elasticStrategy;
this.frStrategy = frStrategy;
this.concreteStrategy = concreteStrategy;
this.reinforcementStrategy= reinforcementStrategy;
}
public MaterialUpdateStrategy() : this(
new ElasticUpdateStrategy(),
new FRUpdateStrategy(),
new ConcreteLibUpdateStrategy(),
new ReinforcementLibUpdateStrategy()
) { }
public void Update(IHeadMaterial targetObject, IHeadMaterial sourceObject)
{
CheckObject.CompareTypes(targetObject, sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.Name = sourceObject.Name;
targetObject.Color = sourceObject.Color;

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -7,11 +8,20 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Materials
{
internal class ReinforcementLibUpdateStrategy : IUpdateStrategy<IReinforcementLibMaterial>
public class ReinforcementLibUpdateStrategy : IUpdateStrategy<IReinforcementLibMaterial>
{
LibMaterialUpdateStrategy libUpdateStrategy = new LibMaterialUpdateStrategy();
private IUpdateStrategy<ILibMaterial> libUpdateStrategy;
public ReinforcementLibUpdateStrategy(IUpdateStrategy<ILibMaterial> libUpdateStrategy)
{
this.libUpdateStrategy = libUpdateStrategy;
}
public ReinforcementLibUpdateStrategy() : this(new LibMaterialUpdateStrategy())
{
}
public void Update(IReinforcementLibMaterial targetObject, IReinforcementLibMaterial sourceObject)
{
CheckObject.CompareTypes(targetObject, sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
libUpdateStrategy.Update(targetObject, sourceObject);
}

View File

@@ -23,7 +23,7 @@ namespace StructureHelperLogics.Models.Materials
private readonly List<IMaterialLogic> materialLogics;
public ILibMaterialEntity MaterialEntity { get; set; }
public List<IMaterialSafetyFactor> SafetyFactors { get; }
public List<IMaterialSafetyFactor> SafetyFactors { get; set; }
public IMaterialLogic MaterialLogic { get; set; }
public List<IMaterialLogic> MaterialLogics => materialLogics;

View File

@@ -16,16 +16,18 @@ namespace StructureHelperLogics.Models.Templates.CrossSections
TraceLogger = new ShiftTraceLogger()
};
calculators.Add(forceCalculator);
CrackCalculatorInputData newInputData = new CrackCalculatorInputData();
var newInputData = new CrackCalculatorInputData();
var checkLogic = new CheckCrackCalculatorInputDataLogic
{
InputData = newInputData
};
var crackCalculator = new CrackCalculator(newInputData, checkLogic)
checkLogic.InputData = newInputData;
var crackCalculator = new CrackCalculator(checkLogic, new CrackCalculatorUpdateStrategy(), null)
{
Name = "New Crack Calculator",
TraceLogger = new ShiftTraceLogger()
};
crackCalculator.InputData = newInputData;
calculators.Add(crackCalculator);
return calculators;
}

View File

@@ -18,12 +18,12 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// <summary>
/// Logic of checking of input data for crack calcultor
/// </summary>
public class CheckCrackCalculatorInputDataLogic : ICheckInputDataLogic<CrackCalculatorInputData>
public class CheckCrackCalculatorInputDataLogic : ICheckInputDataLogic<ICrackCalculatorInputData>
{
private bool result;
private ICheckPrimitiveCollectionLogic checkPrimitiveCollectionLogic;
public CrackCalculatorInputData InputData { get; set; }
public ICrackCalculatorInputData InputData { get; set; }
public string CheckResult { get; private set; }

View File

@@ -14,7 +14,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public class CrackCalculator : ICalculator
public class CrackCalculator : ICrackCalculator
{
const LimitStates limitState = LimitStates.SLS;
const CalcTerms longTerm = CalcTerms.LongTerm;
@@ -22,26 +22,30 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
private const double maxSizeOfCrossSection = 1d;
private CrackResult result;
private IGetTupleInputDatasLogic datasLogic;
private CrackCalculatorUpdateStrategy updateStrategy = new();
private ICheckInputDataLogic<CrackCalculatorInputData> checkInputDataLogic;
private IUpdateStrategy<ICrackCalculator> updateStrategy;
private ICheckInputDataLogic<ICrackCalculatorInputData> checkInputDataLogic;
public string Name { get; set; }
public CrackCalculatorInputData InputData { get; set; }
public ICrackCalculatorInputData InputData { get; set; }
public IResult Result => result;
public IShiftTraceLogger? TraceLogger { get; set; }
public CrackCalculator(CrackCalculatorInputData inputData, ICheckInputDataLogic<CrackCalculatorInputData> checkInputDataLogic)
public CrackCalculator(ICheckInputDataLogic<ICrackCalculatorInputData> checkInputDataLogic,
IUpdateStrategy<ICrackCalculator> updateStrategy,
IShiftTraceLogger traceLogger
)
{
InputData = inputData;
this.checkInputDataLogic = checkInputDataLogic;
this.updateStrategy = updateStrategy;
this.TraceLogger = traceLogger;
Name = string.Empty;
}
public CrackCalculator(CrackCalculatorInputData inputData)
: this(inputData,
new CheckCrackCalculatorInputDataLogic()
{ InputData = inputData}
) { }
public CrackCalculator()
: this(new CheckCrackCalculatorInputDataLogic(),
new CrackCalculatorUpdateStrategy(),
new ShiftTraceLogger())
{ }
public object Clone()
{
@@ -50,7 +54,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{
InputData = InputData
};
var newItem = new CrackCalculator(crackInputData, checkDataLogic);
var newItem = new CrackCalculator(checkDataLogic, new CrackCalculatorUpdateStrategy(), new ShiftTraceLogger());
newItem.InputData = crackInputData;
updateStrategy.Update(newItem, this);
return newItem;
}
@@ -75,6 +80,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
private void CheckInputData()
{
checkInputDataLogic.InputData = InputData;
checkInputDataLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger(50);
if (checkInputDataLogic.Check() == false)
{

View File

@@ -10,18 +10,18 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public class CrackCalculatorInputData : IInputData, IHasPrimitives, IHasForceCombinations
public class CrackCalculatorInputData : ICrackCalculatorInputData
{
/// <inheritdoc/>
public List<INdmPrimitive> Primitives { get; private set; }
/// <inheritdoc/>
public List<IForceAction> ForceActions { get; private set; }
public UserCrackInputData UserCrackInputData { get; set; }
public IUserCrackInputData UserCrackInputData { get; set; }
public CrackCalculatorInputData()
{
Primitives = new();
ForceActions = new();
UserCrackInputData = new()
UserCrackInputData = new UserCrackInputData()
{
SetSofteningFactor = true,
SofteningFactor = 1d,

View File

@@ -8,22 +8,22 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public class CrackCalculatorUpdateStrategy : IUpdateStrategy<CrackCalculator>
public class CrackCalculatorUpdateStrategy : IUpdateStrategy<ICrackCalculator>
{
private IUpdateStrategy<CrackCalculatorInputData> inputDataUpdateStrategy;
private IUpdateStrategy<ICrackCalculatorInputData> inputDataUpdateStrategy;
public CrackCalculatorUpdateStrategy(IUpdateStrategy<CrackCalculatorInputData> inputDataUpdateStrategy)
public CrackCalculatorUpdateStrategy(IUpdateStrategy<ICrackCalculatorInputData> inputDataUpdateStrategy)
{
this.inputDataUpdateStrategy = inputDataUpdateStrategy;
}
public CrackCalculatorUpdateStrategy() : this(new CrackInputDataUpdateStrategy()) { }
public void Update(CrackCalculator targetObject, CrackCalculator sourceObject)
public void Update(ICrackCalculator targetObject, ICrackCalculator sourceObject)
{
if (ReferenceEquals(targetObject, sourceObject)) { return; }
CheckObject.CompareTypes(targetObject, sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.Name = sourceObject.Name;
targetObject.InputData ??= new();
targetObject.InputData ??= new CrackCalculatorInputData();
inputDataUpdateStrategy.Update(targetObject.InputData, sourceObject.InputData);
}
}

View File

@@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public class CrackInputDataUpdateStrategy : IUpdateStrategy<CrackCalculatorInputData>
public class CrackInputDataUpdateStrategy : IUpdateStrategy<ICrackCalculatorInputData>
{
private IUpdateStrategy<IUserCrackInputData> userCrackInputDataUpdateStrategy;
public CrackInputDataUpdateStrategy(IUpdateStrategy<IUserCrackInputData> userCrackInputDataUpdateStrategy)
@@ -20,10 +20,10 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{
}
public void Update(CrackCalculatorInputData targetObject, CrackCalculatorInputData sourceObject)
public void Update(ICrackCalculatorInputData targetObject, ICrackCalculatorInputData sourceObject)
{
if (ReferenceEquals(targetObject, sourceObject)) { return; }
CheckObject.CompareTypes(targetObject, sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.ForceActions.Clear();
targetObject.ForceActions.AddRange(sourceObject.ForceActions);
targetObject.Primitives.Clear();

View File

@@ -13,10 +13,11 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{
public class CrackWidthCalculationLogic : ICrackWidthCalculationLogic
{
private IRebarStressResultLogic rebarStressResultLogic;
private ICrackWidthLogic crackWidthLogic;
private RebarCrackResult result;
private ICrackSofteningLogic crackSofteningLogic;
private RebarStressResult rebarStressResult;
private IRebarStressResult rebarStressResult;
private ICrackWidthLogicInputData acrc2InputData;
private ICrackWidthLogicInputData acrc1InputData;
private ICrackWidthLogicInputData acrc3InputData;
@@ -39,14 +40,14 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public IShiftTraceLogger? TraceLogger { get; set; }
public CrackWidthCalculationLogic(IRebarStressCalculator rebarStressCalculator, ICrackWidthLogic crackWidthLogic, IShiftTraceLogger? traceLogger)
public CrackWidthCalculationLogic(IRebarStressResultLogic rebarStressResultLogic, ICrackWidthLogic crackWidthLogic, IShiftTraceLogger? traceLogger)
{
this.rebarStressCalculator = rebarStressCalculator;
this.rebarStressResultLogic = rebarStressResultLogic;
this.crackWidthLogic = crackWidthLogic;
this.TraceLogger = traceLogger;
}
public CrackWidthCalculationLogic() : this (new RebarStressCalculator(), new CrackWidthLogicSP63(), null)
public CrackWidthCalculationLogic() : this (new RebarStressResultLogic(), new CrackWidthLogicSP63(), null)
{
}
@@ -74,7 +75,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
result.ShortTermResult = shortRebarResult;
}
public CrackWidthRebarTupleResult ProcessShortTermCalculations()
private CrackWidthRebarTupleResult ProcessShortTermCalculations()
{
crackSofteningLogic = GetSofteningLogic(InputData.ShortRebarData);
rebarStressResult = GetRebarStressResult(InputData.ShortRebarData);
@@ -98,7 +99,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
return shortRebarResult;
}
public CrackWidthRebarTupleResult ProcessLongTermCalculations()
private CrackWidthRebarTupleResult ProcessLongTermCalculations()
{
crackSofteningLogic = GetSofteningLogic(InputData.LongRebarData);
rebarStressResult = GetRebarStressResult(InputData.LongRebarData);
@@ -168,20 +169,12 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
return crackWidthInputData;
}
public RebarStressResult GetRebarStressResult(IRebarCrackInputData inputData)
private IRebarStressResult GetRebarStressResult(IRebarCrackInputData rebarCrackInputData)
{
rebarStressCalculator.InputData.ForceTuple = inputData.ForceTuple;
rebarStressCalculator.InputData.NdmCollection = inputData.CrackedNdmCollection;
rebarStressCalculator.InputData.RebarPrimitive = InputData.RebarPrimitive;
rebarStressCalculator.Run();
var result = rebarStressCalculator.Result as RebarStressResult;
if (result.IsValid == false)
{
string errorString = LoggerStrings.CalculationError + result.Description;
TraceLogger?.AddMessage($"Rebar name: {InputData.RebarPrimitive.Name}\n" + errorString, TraceLogStatuses.Error);
throw new StructureHelperException(errorString);
}
return result;
rebarStressResultLogic.RebarCrackInputData = rebarCrackInputData;
rebarStressResultLogic.RebarPrimitive = InputData.RebarPrimitive;
rebarStressResultLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger(50);
return rebarStressResultLogic.GetRebarStressResult();
}
}

View File

@@ -12,7 +12,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public double CrackWidth { get; set; }
public double UltimateCrackWidth { get; set; }
public bool IsCrackLessThanUltimate => CrackWidth <= UltimateCrackWidth;
public RebarStressResult RebarStressResult { get; set; }
public IRebarStressResult RebarStressResult { get; set; }
public double SofteningFactor { get; set; }
}
}

View File

@@ -22,9 +22,9 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public LimitStates LimitState { get; set; }
public CalcTerms LongTerm { get; set; }
public CalcTerms ShortTerm { get; set; }
public UserCrackInputData UserCrackInputData { get; set; }
public IUserCrackInputData UserCrackInputData { get; set; }
public GetTupleInputDatasLogic(List<INdmPrimitive> primitives, List<IForceAction> forceActions, UserCrackInputData userCrackInputData)
public GetTupleInputDatasLogic(List<INdmPrimitive> primitives, List<IForceAction> forceActions, IUserCrackInputData userCrackInputData)
{
Primitives = primitives;
ForceActions = forceActions;

View File

@@ -0,0 +1,9 @@
using StructureHelperCommon.Models.Calculators;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public interface ICrackCalculator : ICalculator
{
ICrackCalculatorInputData InputData { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using StructureHelperLogics.NdmCalculations.Primitives;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public interface ICrackCalculatorInputData : IInputData, IHasPrimitives, IHasForceCombinations
{
List<IForceAction> ForceActions { get; }
List<INdmPrimitive> Primitives { get; }
IUserCrackInputData UserCrackInputData { get; set; }
}
}

View File

@@ -8,8 +8,5 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
RebarCrackResult Result { get; }
void Run();
CrackWidthRebarTupleResult ProcessLongTermCalculations();
CrackWidthRebarTupleResult ProcessShortTermCalculations();
RebarStressResult GetRebarStressResult(IRebarCrackInputData inputData);
}
}

View File

@@ -11,6 +11,6 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
CalcTerms LongTerm { get; set; }
CalcTerms ShortTerm { get; set; }
List<TupleCrackInputData> GetTupleInputDatas();
UserCrackInputData UserCrackInputData { get; set; }
IUserCrackInputData UserCrackInputData { get; set; }
}
}

View File

@@ -0,0 +1,25 @@
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public interface IRebarStressResult : IResult
{
/// <summary>
/// Strain tuple which stress and strain is obtained for
/// </summary>
StrainTuple StrainTuple { get; set; }
/// <summary>
/// Strain in fake concrete ndm-part which rounds rebas and locatade at axis of rebar (refrence strain in concrete)
/// </summary>
double ConcreteStrain { get; set; }
/// <summary>
/// Strain in rebar, dimensionless
/// </summary>
double RebarStrain { get; set; }
/// <summary>
/// Stress in rebar, Pa
/// </summary>
double RebarStress { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.NdmCalculations.Primitives;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public interface IRebarStressResultLogic : ILogic
{
IRebarCrackInputData RebarCrackInputData { get; set; }
IRebarPrimitive RebarPrimitive { get; set; }
IRebarStressResult GetRebarStressResult();
}
}

View File

@@ -11,27 +11,19 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// <summary>
/// Result of calculation of stress and strain in rebar
/// </summary>
public class RebarStressResult : IResult
public class RebarStressResult : IRebarStressResult
{
/// <inheritdoc/>
public bool IsValid { get; set; }
/// <inheritdoc/>
public string? Description { get; set; }
/// <summary>
/// Strain tuple which stress and strain is obtained for
/// </summary>
public StrainTuple StrainTuple { get; set; }
/// <summary>
/// Stress in rebar, Pa
/// </summary>
public double RebarStress { get; set; }
/// <summary>
/// Strain in rebar, dimensionless
/// </summary>
public double RebarStrain { get; set; }
/// <summary>
/// Strain in fake concrete ndm-part which rounds rebas and locatade at axis of rebar (refrence strain in concrete)
/// </summary>
public double ConcreteStrain { get; set; }
}
}

View File

@@ -0,0 +1,53 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Loggers;
using StructureHelperCommon.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperCommon.Infrastructures.Interfaces;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public class RebarStressResultLogic : IRebarStressResultLogic
{
private IRebarStressCalculator rebarStressCalculator;
public IRebarPrimitive RebarPrimitive { get; set; }
public IRebarCrackInputData RebarCrackInputData { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public RebarStressResultLogic(IRebarStressCalculator rebarStressCalculator, IShiftTraceLogger? traceLogger)
{
this.rebarStressCalculator = rebarStressCalculator;
this.TraceLogger = traceLogger;
}
public RebarStressResultLogic() : this(new RebarStressCalculator(), null)
{
}
public IRebarStressResult GetRebarStressResult()
{
IRebarStressCalculatorInputData calculatorInputData = new RebarStressCalculatorInputData()
{
ForceTuple = RebarCrackInputData.ForceTuple,
NdmCollection = RebarCrackInputData.CrackedNdmCollection,
RebarPrimitive = RebarPrimitive,
};
rebarStressCalculator.InputData = calculatorInputData;
rebarStressCalculator.Run();
var result = rebarStressCalculator.Result as RebarStressResult;
if (result.IsValid == false)
{
string errorString = LoggerStrings.CalculationError + result.Description;
TraceLogger?.AddMessage($"Rebar name: {RebarPrimitive.Name}\n" + errorString, TraceLogStatuses.Error);
throw new StructureHelperException(errorString);
}
return result;
}
}
}

View File

@@ -34,6 +34,6 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// <summary>
/// Settings ajusted by user
/// </summary>
public UserCrackInputData UserCrackInputData { get; set; }
public IUserCrackInputData UserCrackInputData { get; set; }
}
}

View File

@@ -10,98 +10,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Cracks
[TestFixture]
public class CrackWidthCalculationLogicTests
{
private Mock<IRebarStressCalculator> _calculator;
private Mock<ICrackWidthLogic> _mockCrackWidthLogic;
private Mock<IShiftTraceLogger> _mockTraceLogger;
private CrackWidthCalculationLogic _logic;
private IRebarCrackCalculatorInputData _inputData;
[SetUp]
public void SetUp()
{
_calculator = new Mock<IRebarStressCalculator>();
_mockCrackWidthLogic = new Mock<ICrackWidthLogic>();
_mockTraceLogger = new Mock<IShiftTraceLogger>();
_inputData = new RebarCrackCalculatorInputData
{
};
_inputData.UserCrackInputData = new UserCrackInputData();
_logic = new CrackWidthCalculationLogic(_calculator.Object, _mockCrackWidthLogic.Object, _mockTraceLogger.Object)
{
InputData = _inputData
};
}
[Test]
public void Run_ShouldPrepareNewResultAndProcessCalculations()
{
// Arrange
_mockCrackWidthLogic.Setup(m => m.GetCrackWidth())
.Returns(0.5); // Mock the GetCrackWidth method
// Act
_logic.Run();
// Assert
Assert.NotNull(_logic.Result);
Assert.IsTrue(_logic.Result.IsValid);
_mockTraceLogger.Verify(x => x.AddMessage(It.IsAny<string>()), Times.AtLeastOnce);
}
[Test]
public void ProcessLongTermCalculation_ShouldReturnExpectedResult()
{
// Arrange
_mockCrackWidthLogic.SetupSequence(m => m.GetCrackWidth())
.Returns(0.5) // longTermLoadLongTermConcreteCrackWidth
.Returns(0.2); // longTermLoadShortConcreteWidth
// Act
var result = _logic.ProcessLongTermCalculations();
// Assert
Assert.NotNull(result);
Assert.AreEqual(0.5, result.CrackWidth);
_mockTraceLogger.Verify(x => x.AddMessage(It.IsAny<string>()), Times.AtLeastOnce);
}
[Test]
public void ProcessShortTermCalculations_ShouldReturnExpectedResult()
{
// Arrange
_mockCrackWidthLogic.SetupSequence(m => m.GetCrackWidth())
.Returns(0.2) // longTermLoadShortConcreteWidth
.Returns(0.3); // fullLoadShortConcreteCrackWidth
// Act
var result = _logic.ProcessShortTermCalculations();
// Assert
Assert.NotNull(result);
Assert.AreEqual(0.0, result.CrackWidth); // Assuming acrcShort would be 0 in this scenario
_mockTraceLogger.Verify(x => x.AddMessage(It.IsAny<string>()), Times.AtLeastOnce);
}
[Test]
public void GetRebarStressResult_ShouldReturnValidResult()
{
// Arrange
var mockRebarStressCalculator = new Mock<IRebarStressCalculator>();
var expectedResult = new RebarStressResult { IsValid = true };
mockRebarStressCalculator.Setup(c => c.Run());
mockRebarStressCalculator.Setup(c => c.Result).Returns(expectedResult);
// Act
var result = _logic.GetRebarStressResult(_inputData.ShortRebarData);
// Assert
Assert.NotNull(result);
Assert.IsTrue(result.IsValid);
_mockTraceLogger.Verify(x => x.AddMessage(It.IsAny<string>(), TraceLogStatuses.Error), Times.Never);
}
}
}

View File

@@ -4,6 +4,10 @@ using StructureHelperCommon.Models;
using StructureHelperLogics.NdmCalculations.Cracking;
using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Calculators;
using Autofac.Features.ResolveAnything;
using StructureHelperLogics.NdmCalculations.Triangulations;
using LoaderCalculator.Data.Ndms;
namespace StructureHelperTests.UnitTests.Ndms.Cracks.InputDataTests
{
@@ -11,89 +15,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Cracks.InputDataTests
[TestFixture]
public class CrackWidthCalculationLogicTests
{
private Mock<IRebarStressCalculator> _calculator;
private Mock<ICrackWidthLogic> mockCrackWidthLogic;
private Mock<IShiftTraceLogger> mockTraceLogger;
private Mock<IRebarCrackCalculatorInputData> mockInputData;
private Mock<IUserCrackInputData> mockUserCrackInputData;
private Mock<IRebarPrimitive> mockRebarPrimitive;
private Mock<IRebarStressCalculator> mockRebarStressCalculator;
private CrackWidthCalculationLogic crackWidthCalculationLogic;
private Mock<IRebarCrackInputData> mockRebarCrackInputData;
[SetUp]
public void SetUp()
{
_calculator = new Mock<IRebarStressCalculator>();
mockCrackWidthLogic = new Mock<ICrackWidthLogic>();
mockTraceLogger = new Mock<IShiftTraceLogger>();
mockInputData = new Mock<IRebarCrackCalculatorInputData>();
mockUserCrackInputData = new Mock<IUserCrackInputData>();
mockRebarPrimitive = new Mock<IRebarPrimitive>();
mockRebarStressCalculator = new Mock<IRebarStressCalculator>();
mockRebarCrackInputData = new Mock<IRebarCrackInputData>();
mockInputData.Setup(x => x.UserCrackInputData).Returns(mockUserCrackInputData.Object);
mockInputData.Setup(x => x.LongRebarData).Returns(mockRebarCrackInputData.Object);
mockInputData.Setup(x => x.ShortRebarData).Returns(mockRebarCrackInputData.Object);
mockInputData.Setup(x => x.RebarPrimitive).Returns(mockRebarPrimitive.Object);
mockRebarCrackInputData.Setup(x => x.ForceTuple).Returns(new ForceTuple());
crackWidthCalculationLogic = new CrackWidthCalculationLogic(_calculator.Object, mockCrackWidthLogic.Object, mockTraceLogger.Object)
{
InputData = mockInputData.Object
};
}
[Test]
public void Run_ShouldPrepareNewResultAndProcessCalculations()
{
// Arrange
mockCrackWidthLogic.Setup(x => x.GetCrackWidth()).Returns(0.5);
// Act
crackWidthCalculationLogic.Run();
// Assert
mockCrackWidthLogic.Verify(x => x.GetCrackWidth(), Times.AtLeastOnce);
Assert.IsNotNull(crackWidthCalculationLogic.Result);
Assert.IsTrue(crackWidthCalculationLogic.Result.IsValid);
}
[Test]
public void ProcessShortTermCalculations_ShouldCalculateCorrectShortTermCrackWidth()
{
// Arrange
mockUserCrackInputData.Setup(x => x.UltimateShortCrackWidth).Returns(1.0);
mockCrackWidthLogic.SetupSequence(x => x.GetCrackWidth())
.Returns(0.6) // longTermLoadShortConcreteWidth
.Returns(0.8); // fullLoadShortConcreteCrackWidth
crackWidthCalculationLogic.InputData = mockInputData.Object;
// Act
var shortTermResult = crackWidthCalculationLogic.ProcessShortTermCalculations();
// Assert
Assert.AreEqual(1.2, shortTermResult.CrackWidth);
Assert.AreEqual(1.0, shortTermResult.UltimateCrackWidth);
}
[Test]
public void ProcessLongTermCalculations_ShouldCalculateCorrectLongTermCrackWidth()
{
// Arrange
mockUserCrackInputData.Setup(x => x.UltimateLongCrackWidth).Returns(1.2);
mockCrackWidthLogic.Setup(x => x.GetCrackWidth()).Returns(0.9);
// Act
var longTermResult = crackWidthCalculationLogic.ProcessLongTermCalculations();
// Assert
Assert.AreEqual(0.9, longTermResult.CrackWidth);
Assert.AreEqual(1.2, longTermResult.UltimateCrackWidth);
}
}

View File

@@ -0,0 +1,80 @@
using Moq;
using NUnit.Framework;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Loggers;
using StructureHelperCommon.Models;
using StructureHelperLogics.NdmCalculations.Cracking;
using StructureHelperLogics.NdmCalculations.Primitives;
namespace StructureHelperTests.UnitTests.Ndms.Cracks
{
[TestFixture]
public class RebarStressResultLogicTests
{
private Mock<IRebarStressCalculator> _mockRebarStressCalculator;
private Mock<IShiftTraceLogger> _mockTraceLogger;
private RebarStressResultLogic _rebarStressResultLogic;
[SetUp]
public void Setup()
{
_mockRebarStressCalculator = new Mock<IRebarStressCalculator>();
_mockTraceLogger = new Mock<IShiftTraceLogger>();
_rebarStressResultLogic = new RebarStressResultLogic(_mockRebarStressCalculator.Object, _mockTraceLogger.Object);
}
[Test]
public void GetRebarStressResult_WhenCalculationIsValid_ReturnsRebarStressResult()
{
// Arrange
var mockRebarStressResult = new RebarStressResult
{
IsValid = true
};
_mockRebarStressCalculator.Setup(x => x.Run());
_mockRebarStressCalculator.Setup(x => x.Result).Returns(mockRebarStressResult);
var mockRebarPrimitive = new Mock<IRebarPrimitive>();
var mockRebarCrackInputData = new Mock<IRebarCrackInputData>();
_rebarStressResultLogic.RebarPrimitive = mockRebarPrimitive.Object;
_rebarStressResultLogic.RebarCrackInputData = mockRebarCrackInputData.Object;
// Act
var result = _rebarStressResultLogic.GetRebarStressResult();
// Assert
Assert.AreEqual(mockRebarStressResult, result);
_mockRebarStressCalculator.Verify(x => x.Run(), Times.Once);
}
[Test]
public void GetRebarStressResult_WhenCalculationIsInvalid_ThrowsStructureHelperException()
{
// Arrange
var mockRebarStressResult = new RebarStressResult
{
IsValid = false,
Description = "Error in calculation"
};
_mockRebarStressCalculator.Setup(x => x.Run());
_mockRebarStressCalculator.Setup(x => x.Result).Returns(mockRebarStressResult);
var mockRebarPrimitive = new Mock<IRebarPrimitive>();
var mockRebarCrackInputData = new Mock<IRebarCrackInputData>();
_rebarStressResultLogic.RebarPrimitive = mockRebarPrimitive.Object;
_rebarStressResultLogic.RebarCrackInputData = mockRebarCrackInputData.Object;
// Act & Assert
var ex = Assert.Throws<StructureHelperException>(() => _rebarStressResultLogic.GetRebarStressResult());
Assert.That(ex.Message, Is.EqualTo(LoggerStrings.CalculationError + mockRebarStressResult.Description));
_mockTraceLogger.Verify(x => x.AddMessage(It.IsAny<string>(), TraceLogStatuses.Error), Times.Once);
}
}
}

View File

@@ -0,0 +1,77 @@
using Moq;
using NUnit.Framework;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.Models.Materials;
using System;
namespace StructureHelperTests.UnitTests.UpdateStrategiesTests
{
namespace YourNamespace.Tests
{
[TestFixture]
public class ConcreteLibUpdateStrategyTests
{
private Mock<IUpdateStrategy<ILibMaterial>> mockLibUpdateStrategy;
private ConcreteLibUpdateStrategy strategy;
[SetUp]
public void Setup()
{
mockLibUpdateStrategy = new Mock<IUpdateStrategy<ILibMaterial>>();
strategy = new ConcreteLibUpdateStrategy(mockLibUpdateStrategy.Object);
}
[Test]
public void Update_ShouldUpdateTargetObject_WhenSourceAndTargetAreNotTheSame()
{
// Arrange
var targetMock = new Mock<IConcreteLibMaterial>();
var sourceMock = new Mock<IConcreteLibMaterial>();
sourceMock.Setup(s => s.TensionForULS).Returns(false);
sourceMock.Setup(s => s.TensionForSLS).Returns(true);
sourceMock.Setup(s => s.RelativeHumidity).Returns(0.75);
// Act
strategy.Update(targetMock.Object, sourceMock.Object);
// Assert
mockLibUpdateStrategy.Verify(l => l.Update(targetMock.Object, sourceMock.Object), Times.Once);
targetMock.VerifySet(t => t.TensionForULS = false);
targetMock.VerifySet(t => t.TensionForSLS = true);
targetMock.VerifySet(t => t.RelativeHumidity = 0.75);
}
[Test]
public void Update_ShouldNotUpdate_WhenSourceAndTargetAreSame()
{
// Arrange
var targetMock = new Mock<IConcreteLibMaterial>();
// Act
strategy.Update(targetMock.Object, targetMock.Object);
// Assert
mockLibUpdateStrategy.Verify(l => l.Update(It.IsAny<IConcreteLibMaterial>(), It.IsAny<IConcreteLibMaterial>()), Times.Never);
targetMock.VerifySet(t => t.TensionForULS = It.IsAny<bool>(), Times.Never);
targetMock.VerifySet(t => t.TensionForSLS = It.IsAny<bool>(), Times.Never);
targetMock.VerifySet(t => t.RelativeHumidity = It.IsAny<double>(), Times.Never);
}
[Test]
public void Update_ShouldThrowStructureHelperException_WhenObjectsAreOfDifferentTypes()
{
// Arrange
var targetMock = new Mock<IConcreteLibMaterial>();
var sourceMock = new Mock<ConcreteLibMaterial>();
// Act & Assert
Assert.Throws<StructureHelperException>(() => strategy.Update(targetMock.Object, sourceMock.Object));
}
}
}
}

View File

@@ -0,0 +1,104 @@
using Moq;
using NUnit.Framework;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.NdmCalculations.Cracking;
namespace StructureHelperTests.UnitTests.UpdateStrategiesTests
{
[TestFixture]
public class CrackCalculatorUpdateStrategyTests
{
private Mock<IUpdateStrategy<ICrackCalculatorInputData>> _inputDataUpdateStrategyMock;
private CrackCalculatorUpdateStrategy _crackCalculatorUpdateStrategy;
[SetUp]
public void SetUp()
{
_inputDataUpdateStrategyMock = new Mock<IUpdateStrategy<ICrackCalculatorInputData>>();
_crackCalculatorUpdateStrategy = new CrackCalculatorUpdateStrategy(_inputDataUpdateStrategyMock.Object);
}
[Test]
public void Update_WhenTargetAndSourceAreSameObject_DoesNotCallInputDataUpdateStrategy()
{
// Arrange
var calculator = new Mock<ICrackCalculator>().Object;
// Act
_crackCalculatorUpdateStrategy.Update(calculator, calculator);
// Assert
_inputDataUpdateStrategyMock.Verify(s => s.Update(It.IsAny<ICrackCalculatorInputData>(), It.IsAny<ICrackCalculatorInputData>()), Times.Never);
}
[Test]
public void Update_WhenSourceObjectIsNull_ThrowsArgumentNullException()
{
// Arrange
var targetObject = new Mock<ICrackCalculator>().Object;
// Act & Assert
Assert.Throws<StructureHelperException>(() => _crackCalculatorUpdateStrategy.Update(targetObject, null));
}
[Test]
public void Update_WhenTargetObjectIsNull_ThrowsArgumentNullException()
{
// Arrange
var sourceObject = new Mock<ICrackCalculator>().Object;
// Act & Assert
Assert.Throws<StructureHelperException>(() => _crackCalculatorUpdateStrategy.Update(null, sourceObject));
}
[Test]
public void Update_UpdatesTargetObjectNameAndCallsInputDataUpdateStrategy()
{
// Arrange
var targetObject = new Mock<ICrackCalculator>();
var sourceObject = new Mock<ICrackCalculator>();
var targetInputData = new Mock<ICrackCalculatorInputData>().Object;
var sourceInputData = new Mock<ICrackCalculatorInputData>().Object;
targetObject.SetupAllProperties();
targetObject.Object.InputData = targetInputData;
sourceObject.SetupAllProperties();
sourceObject.Object.InputData = sourceInputData;
sourceObject.Setup(x => x.Name).Returns("Source Name");
// Act
_crackCalculatorUpdateStrategy.Update(targetObject.Object, sourceObject.Object);
// Assert
Assert.AreEqual("Source Name", targetObject.Object.Name);
_inputDataUpdateStrategyMock.Verify(s => s.Update(targetInputData, sourceInputData), Times.Once);
}
[Test]
public void Update_WhenTargetInputDataIsNull_CreatesNewInputDataAndUpdatesIt()
{
// Arrange
var targetObject = new Mock<ICrackCalculator>();
var sourceObject = new Mock<ICrackCalculator>();
var sourceInputData = new Mock<ICrackCalculatorInputData>().Object;
targetObject.SetupAllProperties();
targetObject.Object.InputData = null;
sourceObject.SetupAllProperties();
sourceObject.Object.InputData = sourceInputData;
// Act
_crackCalculatorUpdateStrategy.Update(targetObject.Object, sourceObject.Object);
// Assert
Assert.IsNotNull(targetObject.Object.InputData);
_inputDataUpdateStrategyMock.Verify(s => s.Update(targetObject.Object.InputData, sourceInputData), Times.Once);
}
}
}

View File

@@ -0,0 +1,89 @@
using Moq;
using NUnit.Framework;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Forces;
using StructureHelperLogics.NdmCalculations.Cracking;
using StructureHelperLogics.NdmCalculations.Primitives;
namespace StructureHelperTests.UnitTests.UpdateStrategiesTests
{
[TestFixture]
public class CrackInputDataUpdateStrategyTests
{
[Test]
public void Update_WithValidInput_UpdatesTargetObject()
{
// Arrange
var mockUserCrackInputDataUpdateStrategy = new Mock<IUpdateStrategy<IUserCrackInputData>>();
var targetObject = new Mock<ICrackCalculatorInputData>();
var sourceObject = new Mock<ICrackCalculatorInputData>();
var forceActions = new List<IForceAction> { new Mock<IForceAction>().Object };
var primitives = new List<INdmPrimitive> { new Mock<INdmPrimitive>().Object };
var userCrackInputData = new Mock<IUserCrackInputData>();
sourceObject.Setup(s => s.ForceActions).Returns(forceActions);
sourceObject.Setup(s => s.Primitives).Returns(primitives);
sourceObject.Setup(s => s.UserCrackInputData).Returns(userCrackInputData.Object);
targetObject.Setup(t => t.ForceActions).Returns(new List<IForceAction>());
targetObject.Setup(t => t.Primitives).Returns(new List<INdmPrimitive>());
targetObject.SetupProperty(t => t.UserCrackInputData, new Mock<IUserCrackInputData>().Object);
var strategy = new CrackInputDataUpdateStrategy(mockUserCrackInputDataUpdateStrategy.Object);
// Act
strategy.Update(targetObject.Object, sourceObject.Object);
// Assert
Assert.AreEqual(forceActions, targetObject.Object.ForceActions);
Assert.AreEqual(primitives, targetObject.Object.Primitives);
mockUserCrackInputDataUpdateStrategy.Verify(s => s.Update(It.IsAny<IUserCrackInputData>(), It.IsAny<IUserCrackInputData>()), Times.Once);
}
[Test]
public void Update_WhenTargetAndSourceAreSame_DoesNotUpdate()
{
// Arrange
var mockUserCrackInputDataUpdateStrategy = new Mock<IUpdateStrategy<IUserCrackInputData>>();
var targetObject = new Mock<ICrackCalculatorInputData>();
var strategy = new CrackInputDataUpdateStrategy(mockUserCrackInputDataUpdateStrategy.Object);
// Act
strategy.Update(targetObject.Object, targetObject.Object);
// Assert
mockUserCrackInputDataUpdateStrategy.Verify(s => s.Update(It.IsAny<IUserCrackInputData>(), It.IsAny<IUserCrackInputData>()), Times.Never);
}
[Test]
public void Update_WithNullTarget_ThrowsStructureHelperException()
{
// Arrange
var mockUserCrackInputDataUpdateStrategy = new Mock<IUpdateStrategy<IUserCrackInputData>>();
var sourceObject = new Mock<ICrackCalculatorInputData>();
var strategy = new CrackInputDataUpdateStrategy(mockUserCrackInputDataUpdateStrategy.Object);
// Act & Assert
Assert.Throws<StructureHelperException>(() => strategy.Update(null, sourceObject.Object));
}
[Test]
public void Update_WithNullSource_ThrowsStructureHelperException()
{
// Arrange
var mockUserCrackInputDataUpdateStrategy = new Mock<IUpdateStrategy<IUserCrackInputData>>();
var targetObject = new Mock<ICrackCalculatorInputData>();
var strategy = new CrackInputDataUpdateStrategy(mockUserCrackInputDataUpdateStrategy.Object);
// Act & Assert
Assert.Throws<StructureHelperException>(() => strategy.Update(targetObject.Object, null));
}
}
}

View File

@@ -0,0 +1,98 @@
using NUnit.Framework;
using Moq;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Materials.Libraries;
using StructureHelperCommon.Models.Materials;
using StructureHelperLogics.Models.Materials;
namespace StructureHelperTests.UnitTests.UpdateStrategiesTests
{
[TestFixture]
public class LibMaterialUpdateStrategyTests
{
private Mock<ILibMaterial> mockTargetMaterial;
private Mock<ILibMaterial> mockSourceMaterial;
private LibMaterialUpdateStrategy updateStrategy;
[SetUp]
public void Setup()
{
mockTargetMaterial = new Mock<ILibMaterial>();
mockSourceMaterial = new Mock<ILibMaterial>();
updateStrategy = new LibMaterialUpdateStrategy();
var targetSafetyFactors = new List<IMaterialSafetyFactor>();
mockTargetMaterial.Setup(t => t.SafetyFactors).Returns(targetSafetyFactors);
}
[Test]
public void Update_ShouldThrowException_WhenTargetAndSourceAreDifferentTypes()
{
// Arrange
var mockTarget1 = new ConcreteLibMaterial();
var mockTarget2 = new ReinforcementLibMaterial();
// Act & Assert
Assert.Throws<StructureHelperException>(() => updateStrategy.Update(mockTarget1, mockTarget2));
}
[Test]
public void Update_ShouldCopyMaterialEntityAndMaterialLogic()
{
// Arrange
var materialEntity = new Mock<ILibMaterialEntity>().Object;
var materialLogic = new Mock<IMaterialLogic>().Object;
mockSourceMaterial.Setup(s => s.MaterialEntity).Returns(materialEntity);
mockSourceMaterial.Setup(s => s.MaterialLogic).Returns(materialLogic);
// Act
updateStrategy.Update(mockTargetMaterial.Object, mockSourceMaterial.Object);
// Assert
mockTargetMaterial.VerifySet(t => t.MaterialEntity = materialEntity, Times.Once);
mockTargetMaterial.VerifySet(t => t.MaterialLogic = materialLogic, Times.Once);
}
//[Test]
public void Update_ShouldClearAndCopySafetyFactors()
{
// Arrange
var mockSafetyFactor1 = new Mock<IMaterialSafetyFactor>();
var mockSafetyFactor2 = new Mock<IMaterialSafetyFactor>();
var safetyFactors = new List<IMaterialSafetyFactor> { mockSafetyFactor1.Object, mockSafetyFactor2.Object };
var targetSafetyFactors = new List<IMaterialSafetyFactor>();
mockSourceMaterial.Setup(s => s.SafetyFactors).Returns(safetyFactors);
mockSafetyFactor1.Setup(f => f.Clone()).Returns(mockSafetyFactor1.Object);
mockSafetyFactor2.Setup(f => f.Clone()).Returns(mockSafetyFactor2.Object);
mockTargetMaterial.Setup(t => t.SafetyFactors).Returns(targetSafetyFactors);
// Act
updateStrategy.Update(mockTargetMaterial.Object, mockSourceMaterial.Object);
// Assert
//mockTargetMaterial.Verify(t => t.SafetyFactors.Clear(), Times.Once);
//mockTargetMaterial.Verify(t => t.SafetyFactors.Add(mockSafetyFactor1.Object), Times.Once);
//mockTargetMaterial.Verify(t => t.SafetyFactors.Add(mockSafetyFactor2.Object), Times.Once);
}
[Test]
public void Update_ShouldNotPerformUpdate_WhenObjectsAreReferenceEqual()
{
//Arrange
// Act
updateStrategy.Update(mockTargetMaterial.Object, mockTargetMaterial.Object);
// Assert
mockTargetMaterial.VerifySet(t => t.MaterialEntity = It.IsAny<ILibMaterialEntity>(), Times.Never);
//mockTargetMaterial.Verify(t => t.SafetyFactors.Clear(), Times.Never);
mockTargetMaterial.VerifySet(t => t.MaterialLogic = It.IsAny<IMaterialLogic>(), Times.Never);
}
}
}