1
0

ComputerContruction.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using Content.IntegrationTests.Tests.Interaction;
  2. namespace Content.IntegrationTests.Tests.Construction.Interaction;
  3. public sealed class ComputerConstruction : InteractionTest
  4. {
  5. private const string Computer = "Computer";
  6. private const string ComputerId = "ComputerId";
  7. private const string ComputerFrame = "ComputerFrame";
  8. private const string IdBoard = "IDComputerCircuitboard";
  9. [Test]
  10. public async Task ConstructComputer()
  11. {
  12. // Place ghost
  13. await StartConstruction(Computer);
  14. // Initial interaction (ghost turns into real entity)
  15. await InteractUsing(Steel, 5);
  16. ClientAssertPrototype(ComputerFrame, Target);
  17. // Perform construction steps
  18. await Interact(
  19. Wrench,
  20. IdBoard,
  21. Screw,
  22. (Cable, 5),
  23. (Glass, 2),
  24. Screw);
  25. // Construction finished, target entity was replaced with a new one:
  26. AssertPrototype(ComputerId, Target);
  27. }
  28. [Test]
  29. public async Task DeconstructComputer()
  30. {
  31. // Spawn initial entity
  32. await StartDeconstruction(ComputerId);
  33. // Initial interaction turns id computer into generic computer
  34. await InteractUsing(Pry);
  35. AssertPrototype(ComputerFrame);
  36. // Perform deconstruction steps
  37. await Interact(
  38. Pry,
  39. Cut,
  40. Screw,
  41. Pry,
  42. Wrench,
  43. Screw);
  44. // construction finished, entity no longer exists.
  45. AssertDeleted();
  46. // Check expected entities were dropped.
  47. await AssertEntityLookup(
  48. IdBoard,
  49. (Cable, 5),
  50. (Steel, 5),
  51. (Glass, 2));
  52. }
  53. [Test]
  54. public async Task ChangeComputer()
  55. {
  56. // Spawn initial entity
  57. await SpawnTarget(ComputerId);
  58. // Initial interaction turns id computer into generic computer
  59. await InteractUsing(Pry);
  60. AssertPrototype(ComputerFrame);
  61. // Perform partial deconstruction steps
  62. await Interact(
  63. Pry,
  64. Cut,
  65. Screw,
  66. Pry);
  67. // Entity should still exist
  68. AssertPrototype(ComputerFrame);
  69. // Begin re-constructing with a new circuit board
  70. await Interact(
  71. "CargoRequestComputerCircuitboard",
  72. Screw,
  73. (Cable, 5),
  74. (Glass, 2),
  75. Screw);
  76. // Construction finished, target entity was replaced with a new one:
  77. AssertPrototype("ComputerCargoOrders");
  78. }
  79. }