public void TestSetPathContainerExistingPath() { IPathContainer container = MockRepository.GenerateMock <IPathContainer>(); Path simplePath = new Path(); container.Stub(x => x.Count).Return(1); container.Stub(x => x.GetLastPath()).Return(simplePath); inputstateControl.SetPathsContainer(container); Assert.IsNull(editorState.SelectedPoint); Assert.IsNotNull(editorState.SelectedPath); Assert.That(editorState.SelectedPath, Is.EqualTo(simplePath)); container.AssertWasNotCalled(x => x.AddPath(Arg <Path> .Is.Anything)); }
public void TestSetPathContainerNewPath() { IPathContainer container = MockRepository.GenerateMock <IPathContainer>(); container.Stub(x => x.Count).Return(0); inputstateControl.SetPathsContainer(container); Assert.IsNull(editorState.SelectedPoint); Assert.IsNotNull(editorState.SelectedPath); container.AssertWasCalled(x => x.AddPath(Arg <Path> .Is.Anything)); }
public void TestEmptyUpdateState() { container.Stub(x => x.GetPathsEnumerator()).Return(null).WhenCalled(x => x.ReturnValue = new List <Path>() { new Path() }.GetEnumerator()); Vector2 vector = new Vector2(200, 150); inputstateControl.UpdateState(vector); Assert.That(editorState.SelectedPoint, Is.EqualTo(new BezierPoint(vector))); Assert.That(editorState.CurrentState, Is.EqualTo(EditorStateControl.MouseState.NewPointDragging)); Assert.That(editorState.ModifierState, Is.EqualTo(EditorStateControl.KeyModifierState.None)); Assert.False(editorState.SelectedPath.IsEmpty()); }