public void ExpandMachineGroups_should_remove_duplicate_machine_names() { var instance = new LogicalInstance("MyInstance") { Machines = { new Machine("MyGroup"), new Machine("MachineA"), new Machine("MachineC"), } }; var groups = new MachineGroup("MyGroup") { MachineNames = { "MachineA", "MachineB" } }; instance.ExpandMachineGroups(new[] { groups }); Assert.AreEqual(3, instance.Machines.Count); Assert.AreEqual(1, instance.Machines.Count(m => m.Name == "MachineA")); Assert.AreEqual(1, instance.Machines.Count(m => m.Name == "MachineB")); Assert.AreEqual(1, instance.Machines.Count(m => m.Name == "MachineC")); }
private static void ForDevelopment( this EnvironmentConfig config) { var machineName = Environment.MachineName; var defaultMachineGroup = config.MachineGroups.SelectByName(DefaultMachineGroupName); if (defaultMachineGroup == null) { defaultMachineGroup = new MachineGroup(DefaultMachineGroupName); config.MachineGroups.Add(defaultMachineGroup); } if (!defaultMachineGroup.MachineNames.Any( name => name.Equals(Environment.MachineName, StringComparison.OrdinalIgnoreCase))) { defaultMachineGroup.MachineNames.Add(Environment.MachineName); } foreach (var app in PlatformApplication.AllApplications) { config.Add(app.Name, DefaultLogicalInstanceName, DefaultMachineGroupName); } }