public void SetVisibilityOfCatalogCorrectly(bool isVisible) { // Arrange bool catalogOpened = false; buildModeHUDController.isCatalogOpen = !isVisible; buildModeHUDController.OnCatalogOpen += () => { catalogOpened = true; }; // Act buildModeHUDController.SetVisibilityOfCatalog(isVisible); // Assert Assert.AreEqual(isVisible, buildModeHUDController.isCatalogOpen, "The isCatalogOpen does not match!"); buildModeHUDController.view.Received(1).SetVisibilityOfCatalog(buildModeHUDController.isCatalogOpen); if (isVisible) { Assert.IsTrue(catalogOpened, "catalogOpened is false!"); } }