public void DelayedBuild_Test() { // Communicate with a real device to get device's module infos var deviceBuilderDelayed = new LaboratoryDeviceBuilder(); foreach (var foundModule in GetDeviceInfo("1234")) { deviceBuilderDelayed.AddModule(foundModule); } var device = deviceBuilderDelayed.Build(); }
public void Build_Test() { var device = new LaboratoryDeviceBuilder() .AddBaseModule(new DeviceModule("base45")) .AddOpticalModule(new DeviceModule("op42")) .Build(); // Builder doesn't have to be used in a fluent way var builder = new LaboratoryDeviceBuilder(); builder.AddBaseModule(new DeviceModule("base45")); builder.AddOpticalModule(new DeviceModule("op42")); var device2 = builder.Build(); }