public void Constructor_CalledWithInvalidType_ShouldThrowArgumentException() { Assert.That(() => new PCComponent( NamesGenerator.ComponentName(), (ComponentType)234567), Throws.ArgumentException); }
public void Constructor_Called_CanCreatePCComponent() { //Arrange var componentName = NamesGenerator.ComponentName(); var component = new PCComponent(componentName, ValidComponentType); Assert.That(component.Name, Is.EqualTo(componentName)); }
public void SetName_Called_ShouldSetNewName() { //Arrange var newComponentName = NamesGenerator.ComponentName(2); //Act DefaultComponent.WithName(newComponentName); //Assert Assert.That(DefaultComponent.Name, Is.EqualTo(newComponentName)); }
private List <PCComponent> CreateComponents(List <ComponentInterface> slotsToInsert, List <ComponentCharacteristic> characteristics) { var componentsToInsert = new List <PCComponent>(); for (var i = 0; i < 5; i++) { var newComponent = new PCComponent(NamesGenerator.ComponentName(i), ComponentType.PowerSupply); newComponent .WithAveragePrice(100 * (i + 1)) .WithPlugSlot(slotsToInsert.RandomElement()) .WithContainedSlot(slotsToInsert.RandomElement()) .WithContainedSlot(slotsToInsert.RandomElementExcept(newComponent.ContainedSlots.ToList())); componentsToInsert.Add(newComponent); AddCharacteristicsToComponent(characteristics, newComponent); } CreateRandomLinks(componentsToInsert); return(componentsToInsert); }