public void Clone() { MachineModel original = new MachineModel(); Storage storage = new Storage { Capacity = 12345678, Free = 123456, Mounted = true, OpenFiles = 3467, Speed = 200000 }; original.Storages.Add(storage); MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(1, original.Storages.Count); Assert.AreEqual(original.Storages[0].Capacity, clone.Storages[0].Capacity); Assert.AreEqual(original.Storages[0].Free, clone.Storages[0].Free); Assert.AreEqual(original.Storages[0].Mounted, clone.Storages[0].Mounted); Assert.AreEqual(original.Storages[0].OpenFiles, clone.Storages[0].OpenFiles); Assert.AreEqual(original.Storages[0].Speed, clone.Storages[0].Speed); Assert.AreNotSame(original.Storages[0].Capacity, clone.Storages[0].Capacity); Assert.AreNotSame(original.Storages[0].Free, clone.Storages[0].Free); Assert.AreNotSame(original.Storages[0].Mounted, clone.Storages[0].Mounted); Assert.AreNotSame(original.Storages[0].OpenFiles, clone.Storages[0].OpenFiles); Assert.AreNotSame(original.Storages[0].Speed, clone.Storages[0].Speed); }
public void Clone() { MachineModel original = new MachineModel(); original.Channels.SPI.RelativePositioning = true; original.Channels.USB.Feedrate = 123F; original.Channels.File.Feedrate = 565F; original.Channels.CodeQueue.UsingInches = true; original.Channels.HTTP.RelativeExtrusion = true; original.Channels.Daemon.Feedrate = 45F; original.Channels[DuetAPI.CodeChannel.Telnet].StackDepth = 5; original.Channels.LCD.LineNumber = 45; original.Channels.AUX.VolumetricExtrusion = true; original.Channels.AutoPause.Compatibility = Compatibility.Marlin; MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(original.Channels.SPI.RelativePositioning, clone.Channels.SPI.RelativePositioning); Assert.AreEqual(original.Channels.USB.Feedrate, clone.Channels.USB.Feedrate); Assert.AreEqual(original.Channels.File.Feedrate, clone.Channels.File.Feedrate); Assert.AreEqual(original.Channels.CodeQueue.UsingInches, clone.Channels.CodeQueue.UsingInches); Assert.AreEqual(original.Channels.HTTP.RelativePositioning, clone.Channels.HTTP.RelativePositioning); Assert.AreEqual(original.Channels.Daemon.Feedrate, clone.Channels.Daemon.Feedrate); Assert.AreEqual(original.Channels.Telnet.StackDepth, clone.Channels.Telnet.StackDepth); Assert.AreEqual(original.Channels.LCD.LineNumber, clone.Channels.LCD.LineNumber); Assert.AreEqual(original.Channels.AUX.VolumetricExtrusion, clone.Channels.AUX.VolumetricExtrusion); Assert.AreEqual(original.Channels.AutoPause.Compatibility, clone.Channels.AutoPause.Compatibility); }
public void Clone() { MachineModel original = new MachineModel(); original.UserSessions.Add(new UserSession { AccessLevel = AccessLevel.ReadOnly, Id = 123, Origin = "192.168.1.123", OriginId = 34545, SessionType = SessionType.HTTP }); original.UserSessions.Add(new UserSession { AccessLevel = AccessLevel.ReadWrite, Id = 124, Origin = "console", OriginId = -1, SessionType = SessionType.Local }); MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(original.UserSessions.Count, clone.UserSessions.Count); Assert.AreEqual(original.UserSessions[0].AccessLevel, clone.UserSessions[0].AccessLevel); Assert.AreEqual(original.UserSessions[0].Id, clone.UserSessions[0].Id); Assert.AreEqual(original.UserSessions[0].Origin, clone.UserSessions[0].Origin); Assert.AreEqual(original.UserSessions[0].OriginId, clone.UserSessions[0].OriginId); Assert.AreEqual(original.UserSessions[0].SessionType, clone.UserSessions[0].SessionType); Assert.AreEqual(original.UserSessions[1].AccessLevel, clone.UserSessions[1].AccessLevel); Assert.AreEqual(original.UserSessions[1].Id, clone.UserSessions[1].Id); Assert.AreEqual(original.UserSessions[1].Origin, clone.UserSessions[1].Origin); Assert.AreEqual(original.UserSessions[1].OriginId, clone.UserSessions[1].OriginId); Assert.AreEqual(original.UserSessions[1].SessionType, clone.UserSessions[1].SessionType); }
public void Clone() { MachineModel original = new MachineModel(); Tool tool = new Tool { Filament = "PET-G", Name = "Mixing Tool", Number = 3, Spindle = 3 }; tool.Active.Add(200F); tool.Active.Add(220F); tool.Fans.Add(3); tool.Heaters.Add(4); tool.Heaters.Add(5); tool.Mix.Add(0.4F); tool.Mix.Add(0.6F); tool.Offsets.Add(12F); tool.Offsets.Add(34F); tool.Offsets.Add(56F); tool.Standby.Add(40F); tool.Standby.Add(60F); tool.Axes.Add(new int[] { 0 }); tool.Axes.Add(new int[] { 1 }); original.Tools.Add(tool); MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(1, original.Tools.Count); Assert.AreEqual(original.Tools[0].Active, clone.Tools[0].Active); Assert.AreEqual(original.Tools[0].Axes.Count, 2); Assert.AreEqual(original.Tools[0].Axes[0], clone.Tools[0].Axes[0]); Assert.AreEqual(original.Tools[0].Axes[1], clone.Tools[0].Axes[1]); Assert.AreEqual(original.Tools[0].Fans, clone.Tools[0].Fans); Assert.AreEqual(original.Tools[0].Filament, clone.Tools[0].Filament); Assert.AreEqual(original.Tools[0].Heaters, clone.Tools[0].Heaters); Assert.AreEqual(original.Tools[0].Mix, clone.Tools[0].Mix); Assert.AreEqual(original.Tools[0].Name, clone.Tools[0].Name); Assert.AreEqual(original.Tools[0].Number, clone.Tools[0].Number); Assert.AreEqual(original.Tools[0].Offsets, clone.Tools[0].Offsets); Assert.AreEqual(original.Tools[0].Spindle, clone.Tools[0].Spindle); Assert.AreEqual(original.Tools[0].Standby, clone.Tools[0].Standby); Assert.AreNotSame(original.Tools[0].Active, clone.Tools[0].Active); Assert.AreNotSame(original.Tools[0].Axes, clone.Tools[0].Axes); Assert.AreNotSame(original.Tools[0].Axes[0], clone.Tools[0].Axes[0]); Assert.AreNotSame(original.Tools[0].Axes[1], clone.Tools[0].Axes[1]); Assert.AreNotSame(original.Tools[0].Fans, clone.Tools[0].Fans); Assert.AreNotSame(original.Tools[0].Filament, clone.Tools[0].Filament); Assert.AreNotSame(original.Tools[0].Heaters, clone.Tools[0].Heaters); Assert.AreNotSame(original.Tools[0].Mix, clone.Tools[0].Mix); Assert.AreNotSame(original.Tools[0].Name, clone.Tools[0].Name); Assert.AreNotSame(original.Tools[0].Number, clone.Tools[0].Number); Assert.AreNotSame(original.Tools[0].Offsets, clone.Tools[0].Offsets); Assert.AreNotSame(original.Tools[0].Spindle, clone.Tools[0].Spindle); Assert.AreNotSame(original.Tools[0].Standby, clone.Tools[0].Standby); }
public void Clone() { MachineModel original = new MachineModel(); Tool tool = new Tool { Active = new float[] { 200F, 220F }, Fans = new int[] { 3 }, Filament = "PET-G", Heaters = new int[] { 4, 5 }, Mix = new float[] { 0.4F, 0.6F }, Name = "Mixing Tool", Number = 3, Offsets = new float[] { 12F, 34F, 56F }, Spindle = 3, Standby = new float[] { 40F, 60F } }; tool.Axes.Add(new int[] { 0 }); tool.Axes.Add(new int[] { 1 }); original.Tools.Add(tool); MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(1, original.Tools.Count); Assert.AreEqual(original.Tools[0].Active, clone.Tools[0].Active); Assert.AreEqual(original.Tools[0].Axes.Count, 2); Assert.AreEqual(original.Tools[0].Axes[0], clone.Tools[0].Axes[0]); Assert.AreEqual(original.Tools[0].Axes[1], clone.Tools[0].Axes[1]); Assert.AreEqual(original.Tools[0].Fans, clone.Tools[0].Fans); Assert.AreEqual(original.Tools[0].Filament, clone.Tools[0].Filament); Assert.AreEqual(original.Tools[0].Heaters, clone.Tools[0].Heaters); Assert.AreEqual(original.Tools[0].Mix, clone.Tools[0].Mix); Assert.AreEqual(original.Tools[0].Name, clone.Tools[0].Name); Assert.AreEqual(original.Tools[0].Number, clone.Tools[0].Number); Assert.AreEqual(original.Tools[0].Offsets, clone.Tools[0].Offsets); Assert.AreEqual(original.Tools[0].Spindle, clone.Tools[0].Spindle); Assert.AreEqual(original.Tools[0].Standby, clone.Tools[0].Standby); Assert.AreNotSame(original.Tools[0].Active, clone.Tools[0].Active); Assert.AreNotSame(original.Tools[0].Axes, clone.Tools[0].Axes); Assert.AreNotSame(original.Tools[0].Axes[0], clone.Tools[0].Axes[0]); Assert.AreNotSame(original.Tools[0].Axes[1], clone.Tools[0].Axes[1]); Assert.AreNotSame(original.Tools[0].Fans, clone.Tools[0].Fans); Assert.AreNotSame(original.Tools[0].Filament, clone.Tools[0].Filament); Assert.AreNotSame(original.Tools[0].Heaters, clone.Tools[0].Heaters); Assert.AreNotSame(original.Tools[0].Mix, clone.Tools[0].Mix); Assert.AreNotSame(original.Tools[0].Name, clone.Tools[0].Name); Assert.AreNotSame(original.Tools[0].Number, clone.Tools[0].Number); Assert.AreNotSame(original.Tools[0].Offsets, clone.Tools[0].Offsets); Assert.AreNotSame(original.Tools[0].Spindle, clone.Tools[0].Spindle); Assert.AreNotSame(original.Tools[0].Standby, clone.Tools[0].Standby); }
public void Clone() { MachineModel original = new MachineModel(); Fan fan = new Fan { Value = 100, Name = "Fan Name", Rpm = 1234, Inverted = true, Frequency = 20000, Min = 0.01F, Max = 0.99F, Blip = 0 }; fan.Thermostatic.Control = false; fan.Thermostatic.Heaters.Add(1); fan.Thermostatic.Heaters.Add(2); fan.Thermostatic.Temperature = 79F; fan.Pin = 23; original.Fans.Add(fan); MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(1, original.Fans.Count); Assert.AreEqual(original.Fans[0].Value, clone.Fans[0].Value); Assert.AreEqual(original.Fans[0].Name, clone.Fans[0].Name); Assert.AreEqual(original.Fans[0].Rpm, clone.Fans[0].Rpm); Assert.AreEqual(original.Fans[0].Inverted, clone.Fans[0].Inverted); Assert.AreEqual(original.Fans[0].Frequency, clone.Fans[0].Frequency); Assert.AreEqual(original.Fans[0].Min, clone.Fans[0].Min); Assert.AreEqual(original.Fans[0].Max, clone.Fans[0].Max); Assert.AreEqual(original.Fans[0].Blip, clone.Fans[0].Blip); Assert.AreEqual(original.Fans[0].Thermostatic.Control, clone.Fans[0].Thermostatic.Control); Assert.AreEqual(original.Fans[0].Thermostatic.Heaters, clone.Fans[0].Thermostatic.Heaters); Assert.AreEqual(original.Fans[0].Thermostatic.Temperature, clone.Fans[0].Thermostatic.Temperature); Assert.AreEqual(original.Fans[0].Pin, clone.Fans[0].Pin); Assert.AreNotSame(original.Fans[0].Value, clone.Fans[0].Value); Assert.AreNotSame(original.Fans[0].Name, clone.Fans[0].Name); Assert.AreNotSame(original.Fans[0].Rpm, clone.Fans[0].Rpm); Assert.AreNotSame(original.Fans[0].Inverted, clone.Fans[0].Inverted); Assert.AreNotSame(original.Fans[0].Frequency, clone.Fans[0].Frequency); Assert.AreNotSame(original.Fans[0].Min, clone.Fans[0].Min); Assert.AreNotSame(original.Fans[0].Max, clone.Fans[0].Max); Assert.AreNotSame(original.Fans[0].Blip, clone.Fans[0].Blip); Assert.AreNotSame(original.Fans[0].Thermostatic.Control, clone.Fans[0].Thermostatic.Control); Assert.AreNotSame(original.Fans[0].Thermostatic.Heaters, clone.Fans[0].Thermostatic.Heaters); Assert.AreNotSame(original.Fans[0].Thermostatic.Temperature, clone.Fans[0].Thermostatic.Temperature); Assert.AreNotSame(original.Fans[0].Pin, clone.Fans[0].Pin); }
public void Clone() { MachineModel original = new MachineModel(); original.Messages.Add(new Message(MessageType.Warning, "Test 1 2 3")); original.Messages.Add(new Message(MessageType.Error, "Err 3 2 1")); MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(2, original.Messages.Count); Assert.AreEqual(original.Messages[0].Content, "Test 1 2 3"); Assert.AreEqual(original.Messages[0].Type, MessageType.Warning); Assert.AreEqual(original.Messages[1].Content, "Err 3 2 1"); Assert.AreEqual(original.Messages[1].Type, MessageType.Error); }
public void Clone() { MachineModel original = new MachineModel(); original.Scanner.Progress = 12.34F; original.Scanner.Status = ScannerStatus.PostProcessing; MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(original.Scanner.Progress, clone.Scanner.Progress); Assert.AreEqual(original.Scanner.Status, clone.Scanner.Status); Assert.AreNotSame(original.Scanner.Progress, clone.Scanner.Progress); Assert.AreNotSame(original.Scanner.Status, clone.Scanner.Status); }
public void Clone() { MachineModel original = new MachineModel(); original.HttpEndpoints.Add(new HttpEndpoint { EndpointType = HttpEndpointType.PATCH, Namespace = "my-demo", Path = "ep", UnixSocket = "/tmp/some.sock" }); MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(original.HttpEndpoints.Count, clone.HttpEndpoints.Count); Assert.AreEqual(original.HttpEndpoints[0].EndpointType, clone.HttpEndpoints[0].EndpointType); Assert.AreEqual(original.HttpEndpoints[0].Namespace, clone.HttpEndpoints[0].Namespace); Assert.AreEqual(original.HttpEndpoints[0].Path, clone.HttpEndpoints[0].Path); Assert.AreEqual(original.HttpEndpoints[0].UnixSocket, clone.HttpEndpoints[0].UnixSocket); }
public void Clone() { MachineModel original = new MachineModel(); original.UserVariables.Add(new UserVariable { Name = "Variable 1", Value = "Value 1" }); original.UserVariables.Add(new UserVariable { Name = "Variable 2", Value = "Value 2" }); MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(original.UserVariables.Count, clone.UserVariables.Count); Assert.AreEqual(original.UserVariables[0].Name, clone.UserVariables[0].Name); }
public void Clone() { MachineModel original = new MachineModel(); original.Directories.GCodes = "0:/gcodes/foo"; original.Directories.Macros = "0:/my macros"; original.Directories.System = "0:/sys/test"; original.Directories.WWW = "0:/www/test"; MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(original.Directories.GCodes, clone.Directories.GCodes); Assert.AreEqual(original.Directories.Macros, clone.Directories.Macros); Assert.AreEqual(original.Directories.System, clone.Directories.System); Assert.AreEqual(original.Directories.WWW, clone.Directories.WWW); }
public void Clone() { MachineModel original = new MachineModel(); original.MessageBox.AxisControls.Add(1); original.MessageBox.AxisControls.Add(2); original.MessageBox.Message = "Message"; original.MessageBox.Mode = MessageBoxMode.OkCancel; original.MessageBox.Title = "Title"; MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(original.MessageBox.AxisControls, clone.MessageBox.AxisControls); Assert.AreEqual(original.MessageBox.Message, clone.MessageBox.Message); Assert.AreEqual(original.MessageBox.Mode, clone.MessageBox.Mode); Assert.AreEqual(original.MessageBox.Title, clone.MessageBox.Title); }
public void Clone() { string modelPath = Path.Combine(Directory.GetCurrentDirectory(), "../../../Machine/JSON/model.json"); string jsonText = System.IO.File.ReadAllText(modelPath); using JsonDocument parsedJson = JsonDocument.Parse(jsonText); MachineModel model = new MachineModel(); model.UpdateFromJson(parsedJson.RootElement); MachineModel newModel = (MachineModel)model.Clone(); string serializedModel = newModel.ToString(); Assert.AreEqual(jsonText, serializedModel); }
public void Clone() { MachineModel original = new MachineModel(); original.State.AtxPower = true; original.State.CurrentTool = 123; original.State.DisplayMessage = "display message"; original.State.LogFile = "log file"; original.State.Mode = MachineMode.Laser; original.State.Status = MachineStatus.Processing; MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(original.State.AtxPower, clone.State.AtxPower); Assert.AreEqual(original.State.CurrentTool, clone.State.CurrentTool); Assert.AreEqual(original.State.DisplayMessage, clone.State.DisplayMessage); Assert.AreEqual(original.State.LogFile, clone.State.LogFile); Assert.AreEqual(original.State.Mode, clone.State.Mode); Assert.AreEqual(original.State.Status, clone.State.Status); }
public void Clone() { MachineModel original = new MachineModel(); original.State.AtxPower = true; original.State.CurrentTool = 123; original.State.Mode = MachineMode.Laser; original.State.Status = MachineStatus.Processing; MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(original.State.AtxPower, clone.State.AtxPower); Assert.AreEqual(original.State.CurrentTool, clone.State.CurrentTool); Assert.AreEqual(original.State.Mode, clone.State.Mode); Assert.AreEqual(original.State.Status, clone.State.Status); Assert.AreNotSame(original.State.AtxPower, clone.State.AtxPower); Assert.AreNotSame(original.State.CurrentTool, clone.State.CurrentTool); Assert.AreNotSame(original.State.Mode, clone.State.Mode); Assert.AreNotSame(original.State.Status, clone.State.Status); }
public void Clone() { MachineModel original = new MachineModel(); Spindle spindle = new Spindle { Active = 123.45F, Current = 45.678F }; original.Spindles.Add(spindle); DuetAPI.Machine.MachineModel clone = (DuetAPI.Machine.MachineModel)original.Clone(); Assert.AreEqual(1, original.Spindles.Count); Assert.AreEqual(original.Spindles[0].Active, clone.Spindles[0].Active); Assert.AreEqual(original.Spindles[0].Current, clone.Spindles[0].Current); Assert.AreNotSame(original.Spindles[0].Active, clone.Spindles[0].Active); Assert.AreNotSame(original.Spindles[0].Current, clone.Spindles[0].Current); }
public void Clone() { MachineModel original = new MachineModel(); NetworkInterface iface = new NetworkInterface(); iface.ActiveProtocols.Add(NetworkProtocol.Telnet); iface.MacAddress = "DE:AD:BE:EF:CA:FE"; iface.ActualIP = "12.34.56.78"; iface.ConfiguredIP = "34.34.56.78"; iface.FirmwareVersion = "Firmware version"; iface.Gateway = "12.34.56.1"; iface.NumReconnects = 123; iface.Signal = -45; iface.Speed = 56; iface.Subnet = "255.0.255.0"; iface.Type = InterfaceType.LAN; original.Network.Interfaces.Add(iface); original.Network.Name = "Name"; original.Network.Password = "******"; MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(1, original.Network.Interfaces.Count); Assert.AreEqual(original.Network.Interfaces[0].ActiveProtocols, clone.Network.Interfaces[0].ActiveProtocols); Assert.AreEqual(original.Network.Interfaces[0].MacAddress, clone.Network.Interfaces[0].MacAddress); Assert.AreEqual(original.Network.Interfaces[0].ActualIP, clone.Network.Interfaces[0].ActualIP); Assert.AreEqual(original.Network.Interfaces[0].ConfiguredIP, clone.Network.Interfaces[0].ConfiguredIP); Assert.AreEqual(original.Network.Interfaces[0].FirmwareVersion, clone.Network.Interfaces[0].FirmwareVersion); Assert.AreEqual(original.Network.Interfaces[0].Gateway, clone.Network.Interfaces[0].Gateway); Assert.AreEqual(original.Network.Interfaces[0].NumReconnects, clone.Network.Interfaces[0].NumReconnects); Assert.AreEqual(original.Network.Interfaces[0].Signal, clone.Network.Interfaces[0].Signal); Assert.AreEqual(original.Network.Interfaces[0].Speed, clone.Network.Interfaces[0].Speed); Assert.AreEqual(original.Network.Interfaces[0].Subnet, clone.Network.Interfaces[0].Subnet); Assert.AreEqual(original.Network.Interfaces[0].Type, clone.Network.Interfaces[0].Type); Assert.AreEqual(original.Network.Name, clone.Network.Name); Assert.AreEqual(original.Network.Password, clone.Network.Password); }
public void Clone() { MachineModel original = new MachineModel(); original.Channels.SPI.RelativePositioning = true; original.Channels.USB.Feedrate = 123; original.Channels.File.Feedrate = 565; original.Channels.File.UsingInches = true; original.Channels.HTTP.RelativeExtrusion = true; original.Channels.Telnet.Feedrate = 45; original.Channels[DuetAPI.CodeChannel.Telnet].StackDepth = 5; MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(original.Channels.SPI.RelativePositioning, clone.Channels.SPI.RelativePositioning); Assert.AreEqual(original.Channels.USB.Feedrate, clone.Channels.USB.Feedrate); Assert.AreEqual(original.Channels.File.Feedrate, clone.Channels.File.Feedrate); Assert.AreEqual(original.Channels.File.UsingInches, clone.Channels.File.UsingInches); Assert.AreEqual(original.Channels.HTTP.RelativePositioning, clone.Channels.HTTP.RelativePositioning); Assert.AreEqual(original.Channels.Telnet.Feedrate, clone.Channels.Telnet.Feedrate); Assert.AreEqual(original.Channels.Telnet.StackDepth, clone.Channels.Telnet.StackDepth); }
public void Clone() { MachineModel original = new MachineModel(); Axis axis = new Axis { Homed = true, Letter = 'X', MachinePosition = 123, Min = -789, MinEndstop = 1, MinProbed = true, Max = 456, MaxEndstop = 2, MaxProbed = true }; axis.Drives.Add(1); axis.Drives.Add(2); original.Move.Axes.Add(axis); original.Move.BabystepZ = 0.34F; original.Move.Compensation = "Compensation"; original.Move.CurrentMove.RequestedSpeed = 45; original.Move.CurrentMove.TopSpeed = 30; Drive drive = new Drive { Acceleration = 12, Current = 1200, MinSpeed = 10, MaxSpeed = 400, Position = 56 }; drive.Microstepping.Interpolated = false; drive.Microstepping.Value = 256; original.Move.Drives.Add(drive); Extruder extruder = new Extruder { Factor = 1.23F }; extruder.Nonlinear.A = 1; extruder.Nonlinear.B = 2; extruder.Nonlinear.Temperature = 56; extruder.Nonlinear.UpperLimit = 78; original.Move.Extruders.Add(extruder); original.Move.Geometry.Type = GeometryType.Delta; original.Move.Idle.Factor = 0.8F; original.Move.Idle.Timeout = 50; original.Move.SpeedFactor = 1.45F; MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(1, clone.Move.Axes.Count); Assert.AreEqual(original.Move.Axes[0].Drives, clone.Move.Axes[0].Drives); Assert.AreEqual(original.Move.Axes[0].Homed, clone.Move.Axes[0].Homed); Assert.AreEqual(original.Move.Axes[0].Letter, clone.Move.Axes[0].Letter); Assert.AreEqual(original.Move.Axes[0].MachinePosition, clone.Move.Axes[0].MachinePosition); Assert.AreEqual(original.Move.Axes[0].Min, clone.Move.Axes[0].Min); Assert.AreEqual(original.Move.Axes[0].MinEndstop, clone.Move.Axes[0].MinEndstop); Assert.AreEqual(original.Move.Axes[0].MinProbed, clone.Move.Axes[0].MinProbed); Assert.AreEqual(original.Move.Axes[0].Max, clone.Move.Axes[0].Max); Assert.AreEqual(original.Move.Axes[0].MaxEndstop, clone.Move.Axes[0].MaxEndstop); Assert.AreEqual(original.Move.Axes[0].MaxProbed, clone.Move.Axes[0].MaxProbed); Assert.AreEqual(original.Move.BabystepZ, clone.Move.BabystepZ); Assert.AreEqual(original.Move.Compensation, clone.Move.Compensation); Assert.AreEqual(original.Move.CurrentMove.RequestedSpeed, clone.Move.CurrentMove.RequestedSpeed); Assert.AreEqual(original.Move.CurrentMove.TopSpeed, clone.Move.CurrentMove.TopSpeed); Assert.AreEqual(1, clone.Move.Drives.Count); Assert.AreEqual(original.Move.Drives[0].Acceleration, clone.Move.Drives[0].Acceleration); Assert.AreEqual(original.Move.Drives[0].Current, clone.Move.Drives[0].Current); Assert.AreEqual(original.Move.Drives[0].MaxSpeed, clone.Move.Drives[0].MaxSpeed); Assert.AreEqual(original.Move.Drives[0].Microstepping.Interpolated, clone.Move.Drives[0].Microstepping.Interpolated); Assert.AreEqual(original.Move.Drives[0].Microstepping.Value, clone.Move.Drives[0].Microstepping.Value); Assert.AreEqual(original.Move.Drives[0].MinSpeed, clone.Move.Drives[0].MinSpeed); Assert.AreEqual(original.Move.Drives[0].Position, clone.Move.Drives[0].Position); Assert.AreEqual(1, clone.Move.Extruders.Count); Assert.AreEqual(original.Move.Extruders[0].Factor, clone.Move.Extruders[0].Factor); Assert.AreEqual(original.Move.Extruders[0].Nonlinear.A, clone.Move.Extruders[0].Nonlinear.A); Assert.AreEqual(original.Move.Extruders[0].Nonlinear.B, clone.Move.Extruders[0].Nonlinear.B); Assert.AreEqual(original.Move.Extruders[0].Nonlinear.Temperature, clone.Move.Extruders[0].Nonlinear.Temperature); Assert.AreEqual(original.Move.Extruders[0].Nonlinear.UpperLimit, clone.Move.Extruders[0].Nonlinear.UpperLimit); Assert.AreEqual(original.Move.Geometry.Type, clone.Move.Geometry.Type); Assert.AreEqual(original.Move.Idle.Factor, clone.Move.Idle.Factor); Assert.AreEqual(original.Move.Idle.Timeout, clone.Move.Idle.Timeout); Assert.AreEqual(original.Move.SpeedFactor, clone.Move.SpeedFactor); }
public void Clone() { MachineModel original = new MachineModel(); original.Job.Duration = 123; original.Job.ExtrudedRaw.Add(123F); original.Job.ExtrudedRaw.Add(456F); original.Job.ExtrudedRaw.Add(789F); original.Job.File.Filament = new List <float> { 654F, 987F }; original.Job.File.GeneratedBy = "Generated by"; original.Job.File.Height = 57; original.Job.File.LayerHeight = 0.43F; original.Job.File.FileName = "0:/gcodes/somefile.g"; original.Job.File.NumLayers = 467; original.Job.File.PrintTime = 4566; original.Job.File.SimulatedTime = 7964; original.Job.File.Size = 4645645; original.Job.FilePosition = 32423; original.Job.LastFileName = "0:/gcodes/lastfile.g"; original.Job.LastFileAborted = true; original.Job.LastFileCancelled = true; original.Job.LastFileSimulated = true; original.Job.Layer = 4; original.Job.Layers.Add(new Layer { Duration = 23, Filament = new List <float> { 12F, 34F, 56F }, FractionPrinted = 0.012F, Height = 0.33F }); original.Job.LayerTime = 4.3F; original.Job.TimesLeft.Filament = 1234; original.Job.TimesLeft.File = 234; original.Job.TimesLeft.Layer = 345; original.Job.WarmUpDuration = 34; MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(original.Job.Duration, clone.Job.Duration); Assert.AreEqual(original.Job.ExtrudedRaw, clone.Job.ExtrudedRaw); Assert.AreEqual(original.Job.File.Filament, clone.Job.File.Filament); Assert.AreEqual(original.Job.File.GeneratedBy, clone.Job.File.GeneratedBy); Assert.AreEqual(original.Job.File.Height, clone.Job.File.Height); Assert.AreEqual(original.Job.File.LayerHeight, clone.Job.File.LayerHeight); Assert.AreEqual(original.Job.File.FileName, clone.Job.File.FileName); Assert.AreEqual(original.Job.File.NumLayers, clone.Job.File.NumLayers); Assert.AreEqual(original.Job.File.PrintTime, clone.Job.File.PrintTime); Assert.AreEqual(original.Job.File.SimulatedTime, clone.Job.File.SimulatedTime); Assert.AreEqual(original.Job.File.Size, clone.Job.File.Size); Assert.AreEqual(original.Job.FilePosition, clone.Job.FilePosition); Assert.AreEqual(original.Job.LastFileName, clone.Job.LastFileName); Assert.AreEqual(original.Job.LastFileAborted, clone.Job.LastFileAborted); Assert.AreEqual(original.Job.LastFileCancelled, clone.Job.LastFileCancelled); Assert.AreEqual(original.Job.LastFileSimulated, clone.Job.LastFileSimulated); Assert.AreEqual(original.Job.Layer, clone.Job.Layer); Assert.AreEqual(1, original.Job.Layers.Count); Assert.AreEqual(original.Job.Layers[0].Duration, clone.Job.Layers[0].Duration); Assert.AreEqual(original.Job.Layers[0].Filament, clone.Job.Layers[0].Filament); Assert.AreEqual(original.Job.Layers[0].FractionPrinted, clone.Job.Layers[0].FractionPrinted); Assert.AreEqual(original.Job.Layers[0].Height, clone.Job.Layers[0].Height); Assert.AreEqual(original.Job.LayerTime, clone.Job.LayerTime); Assert.AreEqual(original.Job.TimesLeft.Filament, clone.Job.TimesLeft.Filament); Assert.AreEqual(original.Job.TimesLeft.File, clone.Job.TimesLeft.File); Assert.AreEqual(original.Job.TimesLeft.Layer, clone.Job.TimesLeft.Layer); Assert.AreEqual(original.Job.WarmUpDuration, clone.Job.WarmUpDuration); }
public void Clone() { MachineModel original = new MachineModel(); BedOrChamber bed = new BedOrChamber { Name = "Bed Name" }; bed.Active.Add(123F); bed.Standby.Add(456F); bed.Heaters.Add(0); original.Heat.Beds.Add(null); original.Heat.Beds.Add(bed); BedOrChamber chamber = new BedOrChamber { Name = "Chamber Name" }; chamber.Active.Add(321F); chamber.Standby.Add(654F); chamber.Heaters.Add(4); chamber.Heaters.Add(6); original.Heat.Chambers.Add(null); original.Heat.Chambers.Add(chamber); original.Heat.ColdExtrudeTemperature = 678F; original.Heat.ColdRetractTemperature = 987F; ExtraHeater extraHeater = new ExtraHeater { Current = 123, Name = "Extra Heater", Sensor = 4, State = HeaterState.Tuning }; original.Heat.Extra.Add(extraHeater); Heater heater = new Heater { Current = 567, Max = 578, Sensor = 6, State = HeaterState.Standby }; heater.Model.DeadTime = 322; heater.Model.Gain = 673; heater.Model.MaxPwm = 0.45F; heater.Model.TimeConstant = 32; original.Heat.Heaters.Add(heater); MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(2, original.Heat.Beds.Count); Assert.AreEqual(original.Heat.Beds[0], null); Assert.AreEqual(original.Heat.Beds[1].Active, clone.Heat.Beds[1].Active); Assert.AreEqual(original.Heat.Beds[1].Standby, clone.Heat.Beds[1].Standby); Assert.AreEqual(original.Heat.Beds[1].Name, clone.Heat.Beds[1].Name); Assert.AreEqual(original.Heat.Beds[1].Heaters, clone.Heat.Beds[1].Heaters); Assert.AreEqual(2, original.Heat.Chambers.Count); Assert.AreEqual(original.Heat.Chambers[0], null); Assert.AreEqual(original.Heat.Chambers[1].Active, clone.Heat.Chambers[1].Active); Assert.AreEqual(original.Heat.Chambers[1].Standby, clone.Heat.Chambers[1].Standby); Assert.AreEqual(original.Heat.Chambers[1].Name, clone.Heat.Chambers[1].Name); Assert.AreEqual(original.Heat.Chambers[1].Heaters, clone.Heat.Chambers[1].Heaters); Assert.AreEqual(original.Heat.ColdExtrudeTemperature, clone.Heat.ColdExtrudeTemperature); Assert.AreEqual(original.Heat.ColdRetractTemperature, clone.Heat.ColdRetractTemperature); Assert.AreEqual(1, original.Heat.Extra.Count); Assert.AreEqual(original.Heat.Extra[0].Current, clone.Heat.Extra[0].Current); Assert.AreEqual(original.Heat.Extra[0].Name, clone.Heat.Extra[0].Name); Assert.AreEqual(original.Heat.Extra[0].Sensor, clone.Heat.Extra[0].Sensor); Assert.AreEqual(original.Heat.Extra[0].State, clone.Heat.Extra[0].State); Assert.AreEqual(1, original.Heat.Heaters.Count); Assert.AreEqual(original.Heat.Heaters[0].Current, clone.Heat.Heaters[0].Current); Assert.AreEqual(original.Heat.Heaters[0].Max, clone.Heat.Heaters[0].Max); Assert.AreEqual(original.Heat.Heaters[0].Sensor, clone.Heat.Heaters[0].Sensor); Assert.AreEqual(original.Heat.Heaters[0].State, clone.Heat.Heaters[0].State); Assert.AreEqual(original.Heat.Heaters[0].Model.DeadTime, clone.Heat.Heaters[0].Model.DeadTime); Assert.AreEqual(original.Heat.Heaters[0].Model.Gain, clone.Heat.Heaters[0].Model.Gain); Assert.AreEqual(original.Heat.Heaters[0].Model.MaxPwm, clone.Heat.Heaters[0].Model.MaxPwm); Assert.AreEqual(original.Heat.Heaters[0].Model.TimeConstant, clone.Heat.Heaters[0].Model.TimeConstant); }
public void Clone() { MachineModel original = new MachineModel(); original.Electronics.Type = "Electronics Type"; original.Electronics.Name = "Electronics Name"; original.Electronics.Revision = "Electronics Revision"; original.Electronics.Firmware.Name = "Firmware Name"; original.Electronics.Firmware.Version = "Firmware Version"; original.Electronics.Firmware.Date = "Firmware Date"; original.Electronics.ProcessorID = "Processor ID"; original.Electronics.VIn.Current = 321; original.Electronics.VIn.Min = 654; original.Electronics.VIn.Max = 987; original.Electronics.McuTemp.Current = 123; original.Electronics.McuTemp.Min = 456; original.Electronics.McuTemp.Max = 789; ExpansionBoard expansionBoard = new ExpansionBoard(); expansionBoard.Name = "Expansion Name"; expansionBoard.Revision = "Expansion Revision"; expansionBoard.Firmware.Name = "Expansion Firmware Name"; expansionBoard.Firmware.Date = "Expansion Firmware Date"; expansionBoard.Firmware.Version = "Expansion Firmware Version"; expansionBoard.VIn.Current = 321; expansionBoard.VIn.Min = 654; expansionBoard.VIn.Max = 987; expansionBoard.McuTemp.Current = 123; expansionBoard.McuTemp.Min = 456; expansionBoard.McuTemp.Max = 789; expansionBoard.MaxHeaters = 12; expansionBoard.MaxMotors = 6; original.Electronics.ExpansionBoards.Add(expansionBoard); MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(original.Electronics.Type, clone.Electronics.Type); Assert.AreEqual(original.Electronics.Name, clone.Electronics.Name); Assert.AreEqual(original.Electronics.Revision, clone.Electronics.Revision); Assert.AreEqual(original.Electronics.Firmware.Name, clone.Electronics.Firmware.Name); Assert.AreEqual(original.Electronics.Firmware.Version, clone.Electronics.Firmware.Version); Assert.AreEqual(original.Electronics.Firmware.Date, clone.Electronics.Firmware.Date); Assert.AreEqual(original.Electronics.ProcessorID, clone.Electronics.ProcessorID); Assert.AreEqual(original.Electronics.VIn.Current, clone.Electronics.VIn.Current); Assert.AreEqual(original.Electronics.VIn.Min, clone.Electronics.VIn.Min); Assert.AreEqual(original.Electronics.VIn.Max, clone.Electronics.VIn.Max); Assert.AreEqual(original.Electronics.McuTemp.Current, clone.Electronics.McuTemp.Current); Assert.AreEqual(original.Electronics.McuTemp.Min, clone.Electronics.McuTemp.Min); Assert.AreEqual(original.Electronics.McuTemp.Max, clone.Electronics.McuTemp.Max); Assert.AreEqual(1, clone.Electronics.ExpansionBoards.Count); Assert.AreEqual(original.Electronics.ExpansionBoards[0].Name, clone.Electronics.ExpansionBoards[0].Name); Assert.AreEqual(original.Electronics.ExpansionBoards[0].Revision, clone.Electronics.ExpansionBoards[0].Revision); Assert.AreEqual(original.Electronics.ExpansionBoards[0].Firmware.Name, clone.Electronics.ExpansionBoards[0].Firmware.Name); Assert.AreEqual(original.Electronics.ExpansionBoards[0].Firmware.Date, clone.Electronics.ExpansionBoards[0].Firmware.Date); Assert.AreEqual(original.Electronics.ExpansionBoards[0].Firmware.Version, clone.Electronics.ExpansionBoards[0].Firmware.Version); Assert.AreEqual(original.Electronics.ExpansionBoards[0].VIn.Current, clone.Electronics.ExpansionBoards[0].VIn.Current); Assert.AreEqual(original.Electronics.ExpansionBoards[0].VIn.Min, clone.Electronics.ExpansionBoards[0].VIn.Min); Assert.AreEqual(original.Electronics.ExpansionBoards[0].VIn.Max, clone.Electronics.ExpansionBoards[0].VIn.Max); Assert.AreEqual(original.Electronics.ExpansionBoards[0].McuTemp.Current, clone.Electronics.ExpansionBoards[0].McuTemp.Current); Assert.AreEqual(original.Electronics.ExpansionBoards[0].McuTemp.Min, clone.Electronics.ExpansionBoards[0].McuTemp.Min); Assert.AreEqual(original.Electronics.ExpansionBoards[0].McuTemp.Max, clone.Electronics.ExpansionBoards[0].McuTemp.Max); Assert.AreEqual(original.Electronics.ExpansionBoards[0].MaxHeaters, clone.Electronics.ExpansionBoards[0].MaxHeaters); Assert.AreEqual(original.Electronics.ExpansionBoards[0].MaxMotors, clone.Electronics.ExpansionBoards[0].MaxMotors); Assert.AreNotSame(original.Electronics.Type, clone.Electronics.Type); Assert.AreNotSame(original.Electronics.Name, clone.Electronics.Name); Assert.AreNotSame(original.Electronics.Revision, clone.Electronics.Revision); Assert.AreNotSame(original.Electronics.Firmware.Name, clone.Electronics.Firmware.Name); Assert.AreNotSame(original.Electronics.Firmware.Version, clone.Electronics.Firmware.Version); Assert.AreNotSame(original.Electronics.Firmware.Date, clone.Electronics.Firmware.Date); Assert.AreNotSame(original.Electronics.ProcessorID, clone.Electronics.ProcessorID); Assert.AreNotSame(original.Electronics.VIn.Current, clone.Electronics.VIn.Current); Assert.AreNotSame(original.Electronics.VIn.Min, clone.Electronics.VIn.Min); Assert.AreNotSame(original.Electronics.VIn.Max, clone.Electronics.VIn.Max); Assert.AreNotSame(original.Electronics.McuTemp.Current, clone.Electronics.McuTemp.Current); Assert.AreNotSame(original.Electronics.McuTemp.Min, clone.Electronics.McuTemp.Min); Assert.AreNotSame(original.Electronics.McuTemp.Max, clone.Electronics.McuTemp.Max); Assert.AreNotSame(original.Electronics.ExpansionBoards[0].Name, clone.Electronics.ExpansionBoards[0].Name); Assert.AreNotSame(original.Electronics.ExpansionBoards[0].Revision, clone.Electronics.ExpansionBoards[0].Revision); Assert.AreNotSame(original.Electronics.ExpansionBoards[0].Firmware.Name, clone.Electronics.ExpansionBoards[0].Firmware.Name); Assert.AreNotSame(original.Electronics.ExpansionBoards[0].Firmware.Date, clone.Electronics.ExpansionBoards[0].Firmware.Date); Assert.AreNotSame(original.Electronics.ExpansionBoards[0].Firmware.Version, clone.Electronics.ExpansionBoards[0].Firmware.Version); Assert.AreNotSame(original.Electronics.ExpansionBoards[0].VIn.Current, clone.Electronics.ExpansionBoards[0].VIn.Current); Assert.AreNotSame(original.Electronics.ExpansionBoards[0].VIn.Min, clone.Electronics.ExpansionBoards[0].VIn.Min); Assert.AreNotSame(original.Electronics.ExpansionBoards[0].VIn.Max, clone.Electronics.ExpansionBoards[0].VIn.Max); Assert.AreNotSame(original.Electronics.ExpansionBoards[0].McuTemp.Current, clone.Electronics.ExpansionBoards[0].McuTemp.Current); Assert.AreNotSame(original.Electronics.ExpansionBoards[0].McuTemp.Min, clone.Electronics.ExpansionBoards[0].McuTemp.Min); Assert.AreNotSame(original.Electronics.ExpansionBoards[0].McuTemp.Max, clone.Electronics.ExpansionBoards[0].McuTemp.Max); Assert.AreNotSame(original.Electronics.ExpansionBoards[0].MaxHeaters, clone.Electronics.ExpansionBoards[0].MaxHeaters); Assert.AreNotSame(original.Electronics.ExpansionBoards[0].MaxMotors, clone.Electronics.ExpansionBoards[0].MaxMotors); }
public void Clone() { MachineModel original = new MachineModel(); Endstop endstop = new Endstop { Position = EndstopPosition.HighEnd, Triggered = true, Type = EndstopType.MotorLoadDetection }; original.Sensors.Endstops.Add(endstop); Probe probe = new Probe { DisablesBed = true, DiveHeight = 45.6F, Inverted = true, MaxProbeCount = 4, RecoveryTime = 0.65F, SecondaryValues = new int[] { 12, 34 }, Speed = 456, Threshold = 678, Tolerance = 0.42F, TravelSpeed = 500, TriggerHeight = 1.23F, Type = ProbeType.E1Switch, Value = 45 }; original.Sensors.Probes.Add(probe); MachineModel clone = (MachineModel)original.Clone(); Assert.AreEqual(1, original.Sensors.Endstops.Count); Assert.AreEqual(original.Sensors.Endstops[0].Position, clone.Sensors.Endstops[0].Position); Assert.AreEqual(original.Sensors.Endstops[0].Triggered, clone.Sensors.Endstops[0].Triggered); Assert.AreEqual(original.Sensors.Endstops[0].Type, clone.Sensors.Endstops[0].Type); Assert.AreEqual(1, original.Sensors.Probes.Count); Assert.AreEqual(original.Sensors.Probes[0].DisablesBed, clone.Sensors.Probes[0].DisablesBed); Assert.AreEqual(original.Sensors.Probes[0].DiveHeight, clone.Sensors.Probes[0].DiveHeight); Assert.AreEqual(original.Sensors.Probes[0].Inverted, clone.Sensors.Probes[0].Inverted); Assert.AreEqual(original.Sensors.Probes[0].MaxProbeCount, clone.Sensors.Probes[0].MaxProbeCount); Assert.AreEqual(original.Sensors.Probes[0].RecoveryTime, clone.Sensors.Probes[0].RecoveryTime); Assert.AreEqual(original.Sensors.Probes[0].SecondaryValues, clone.Sensors.Probes[0].SecondaryValues); Assert.AreEqual(original.Sensors.Probes[0].Speed, clone.Sensors.Probes[0].Speed); Assert.AreEqual(original.Sensors.Probes[0].Threshold, clone.Sensors.Probes[0].Threshold); Assert.AreEqual(original.Sensors.Probes[0].Tolerance, clone.Sensors.Probes[0].Tolerance); Assert.AreEqual(original.Sensors.Probes[0].TravelSpeed, clone.Sensors.Probes[0].TravelSpeed); Assert.AreEqual(original.Sensors.Probes[0].TriggerHeight, clone.Sensors.Probes[0].TriggerHeight); Assert.AreEqual(original.Sensors.Probes[0].Type, clone.Sensors.Probes[0].Type); Assert.AreEqual(original.Sensors.Probes[0].Value, clone.Sensors.Probes[0].Value); Assert.AreNotSame(original.Sensors.Endstops[0].Position, clone.Sensors.Endstops[0].Position); Assert.AreNotSame(original.Sensors.Endstops[0].Triggered, clone.Sensors.Endstops[0].Triggered); Assert.AreNotSame(original.Sensors.Endstops[0].Type, clone.Sensors.Endstops[0].Type); Assert.AreNotSame(original.Sensors.Probes[0].DisablesBed, clone.Sensors.Probes[0].DisablesBed); Assert.AreNotSame(original.Sensors.Probes[0].DiveHeight, clone.Sensors.Probes[0].DiveHeight); Assert.AreNotSame(original.Sensors.Probes[0].Inverted, clone.Sensors.Probes[0].Inverted); Assert.AreNotSame(original.Sensors.Probes[0].MaxProbeCount, clone.Sensors.Probes[0].MaxProbeCount); Assert.AreNotSame(original.Sensors.Probes[0].RecoveryTime, clone.Sensors.Probes[0].RecoveryTime); Assert.AreNotSame(original.Sensors.Probes[0].SecondaryValues, clone.Sensors.Probes[0].SecondaryValues); Assert.AreNotSame(original.Sensors.Probes[0].Speed, clone.Sensors.Probes[0].Speed); Assert.AreNotSame(original.Sensors.Probes[0].Threshold, clone.Sensors.Probes[0].Threshold); Assert.AreNotSame(original.Sensors.Probes[0].Tolerance, clone.Sensors.Probes[0].Tolerance); Assert.AreNotSame(original.Sensors.Probes[0].TravelSpeed, clone.Sensors.Probes[0].TravelSpeed); Assert.AreNotSame(original.Sensors.Probes[0].TriggerHeight, clone.Sensors.Probes[0].TriggerHeight); Assert.AreNotSame(original.Sensors.Probes[0].Type, clone.Sensors.Probes[0].Type); Assert.AreNotSame(original.Sensors.Probes[0].Value, clone.Sensors.Probes[0].Value); }