Ejemplo n.º 1
0
        public void CurrentHilitedShowButtonRect_ReturnsLocationOfHilitedShowButton_WhenUpdateCurrentShowButtonCoordsCommandFired()
        {
            var fe = new FrameworkElement();
            var converterStub = new Mock<FrameworkElementToWin32CoordsConverter>();
            converterStub.Setup(c => c.GetFrameworkElementWin32PixelRect(fe)).Returns(new Rect(20, 30, 100, 110));
            var vm = new FakeGuiTypeViewModel();
            vm.ForcedFrameworkElementToWin32CoordsConverterConverter = converterStub.Object;

            vm.UpdateCurrentShowButtonCoordsCommand.Execute(fe);
            var rect = vm.CurrentHilitedShowButtonRect;

            Assert.AreEqual(new Rect(20, 30, 100, 110), rect);
        }
Ejemplo n.º 2
0
        public void CurrentHilitedShowButtonRect_GetsUpdated_WhenUpdateCurrentShowButtonCoordsCommandFired()
        {
            var fe = new FrameworkElement();
            var notifiedProps = new List<string>();
            var vm = new FakeGuiTypeViewModel();
            var converter = new Mock<FrameworkElementToWin32CoordsConverter>();
            converter.Setup(c => c.GetFrameworkElementWin32PixelRect(fe)).Returns(new Rect(20, 30, 100, 110));
            vm.ForcedFrameworkElementToWin32CoordsConverterConverter = converter.Object;
            vm.PropertyChanged += (sender, args) => notifiedProps.Add(args.PropertyName);

            notifiedProps.Clear();
            vm.UpdateCurrentShowButtonCoordsCommand.Execute(fe);

            Assert.IsTrue(notifiedProps.Contains("CurrentHilitedShowButtonRect"));
        }