public SceneEditorViewModel(string sceneFilePath, IEventBus eventBus, ISceneLoader sceneLoader, ISceneModelFactory sceneModelFactory) { _sceneFilePath = sceneFilePath; _eventBus = eventBus; _sceneLoader = sceneLoader; _scene = _sceneLoader.Load(_sceneFilePath); _sceneModel = sceneModelFactory.Create(_scene); }
public void OnDocumentSelected_ShouldSendEventWithSceneModel() { // Arrange var scene = TestSceneFactory.Create(); var sceneModel = TestSceneModelFactory.Create(scene); _sceneLoader.Load(SceneFilePath).Returns(scene); _sceneModelFactory.Create(scene).Returns(sceneModel); var sceneEditorViewModel = new SceneEditorViewModel(SceneFilePath, _eventBus, _sceneLoader, _sceneModelFactory); SelectedSceneModelChangedEvent? @event = null; _eventBus.RegisterEventHandler <SelectedSceneModelChangedEvent>(e => @event = e); // Act sceneEditorViewModel.OnDocumentSelected(); // Assert Assert.That(@event, Is.Not.Null); Assert.That(@event !.SceneModel, Is.EqualTo(sceneModel)); }