public static void PutIntoContainer(Box container, Shape shape) { string statusMsg; if (container.AddAvailable(shape)) { container.emptyVolume -= shape.Volume; container.AddShape(shape); statusMsg = $"SUCCESSFULLY ADDED: [{shape.Name}] with volume [{shape.Volume}] into the Container."; } else { statusMsg = $"NOT ENOUGH SPACE: [{shape.Name}] with volume [{shape.Volume}]."; } string freeContainerSpaceMsg = $"Free Container space: [{container.emptyVolume.ToString()}]."; string usedContainerSpaceMsg = $"Used Container space: [{(container.Volume - container.emptyVolume).ToString()}]"; string shapesInsideMsg = $"Shapes inside: {{{string.Join(',', container.Shapes.Select(s => s.Name).ToList())}}}"; Console.WriteLine(statusMsg); Console.WriteLine(freeContainerSpaceMsg); Console.WriteLine(usedContainerSpaceMsg); Console.WriteLine(shapesInsideMsg); }
public void AddAvailable_EmptyVolumeLessThanShapeVolume_returnsFalse() { Box container = new Box(5); Box shape = new Box(10); bool addIsAvailable = container.AddAvailable(shape); Assert.False(addIsAvailable); }