示例#1
0
        public void ClipBoardUpdateEventsAreCorrectlyProcessed()
        {
            var mockObjects          = MockFactories.GetMockObjects();
            var clipboardConfig      = Mock.Get((IClipboardConfiguration)mockObjects[nameof(IClipboardConfiguration)]);
            var sharpClipboardMapper = Mock.Get((ISharpClipboardMapper)mockObjects[nameof(ISharpClipboardMapper)]);
            var textCopyMapper       = Mock.Get((ITextCopyMapper)mockObjects[nameof(ITextCopyMapper)]);

            var clipboardManager = MockFactories.ClipboardManagerFactory(mockObjects);

            string[] entries = new[] { string.Empty };
            clipboardManager.ClipboardTextUpdateReceived += (s, e) =>
            {
                entries = e.ClipboardEntries;
            };

            sharpClipboardMapper.Raise(
                x => x.ClipboardChanged += null,
                this,
                new ClipboardChangedEventArgs(
                    applicationName: "testApp",
                    clipboardContent: "testContent",
                    contentType: SharpClipboard.ContentTypes.Text));

            Assert.True(entries.Length == 1);
            Assert.Equal("testContent", entries[0]);
        }
        [InlineData("0,1", new[] { Ca.Dec, Ca.Nr1 })]                         // Decimal
        public void ShowExpectedOutputText_WhenActionsArePerformedAfterCalculationOfEndNumber(string expectedOutputTextAfterAllOperations, Ca[] actions)
        {
            var vm = MockFactories.FinCalcViewModelWithCalculatorImplementationFactory(out _);

            this.PerformBasicEndCapitalCalculation(vm);
            FinCalcViewModelHelper.ExecuteDummyActionsAndCheckOutput(actions, expectedOutputTextAfterAllOperations, vm);
        }
示例#3
0
        public void ProcessingMultipleRowsAndTrimmingSucceeds()
        {
            var mockObjects          = MockFactories.GetMockObjects();
            var clipboardConfig      = Mock.Get((IClipboardConfiguration)mockObjects[nameof(IClipboardConfiguration)]);
            var sharpClipboardMapper = Mock.Get((ISharpClipboardMapper)mockObjects[nameof(ISharpClipboardMapper)]);
            var textCopyMapper       = Mock.Get((ITextCopyMapper)mockObjects[nameof(ITextCopyMapper)]);

            clipboardConfig.SetupGet(x => x.AutomaticTrim).Returns(true);
            clipboardConfig.SetupGet(x => x.ProcessMultipleRows).Returns(true);
            clipboardConfig.SetupGet(x => x.MaxProcessedRows).Returns(100);

            var clipboardManager = MockFactories.ClipboardManagerFactory(mockObjects);

            string[] entries = new[] { string.Empty };
            clipboardManager.ClipboardTextUpdateReceived += (s, e) =>
            {
                entries = e.ClipboardEntries;
            };

            sharpClipboardMapper.Raise(
                x => x.ClipboardChanged += null,
                this,
                new ClipboardChangedEventArgs(
                    applicationName: "testApp",
                    clipboardContent: " testContent " + Environment.NewLine + " testContent2 ",
                    contentType: SharpClipboard.ContentTypes.Text));

            Assert.True(entries.Length == 2);
            Assert.Equal("testContent", entries[0]);
            Assert.Equal("testContent2", entries[1]);
        }
        public void SetSpecialNumbers_WhenSpecialNumberSettersAreCalled()
        {
            // Arrange
            var vm = MockFactories.FinCalcViewModelWithCalculatorImplementationFactory(out _);

            // Act
            var testSequence = new[]
            {
                Ca.Nr1, Ca.Nr0, Ca.SetRpa,
                Ca.Nr1, Ca.Nr0, Ca.SetYears,
                Ca.Nr2, Ca.SetInt,
                Ca.Nr1, Ca.Nr5, Ca.Nr0, Ca.Nr0, Ca.Nr0, Ca.Nr0, Ca.SetStart,
                Ca.Nr34, Ca.Nr0, Ca.Alg, Ca.SetRate,
                Ca.Nr1, Ca.Nr0, Ca.Nr0, Ca.Nr0, Ca.Nr0, Ca.SetEnd,
            };

            FinCalcViewModelHelper.ExecuteDummyActions(vm, testSequence);

            // Assert
            vm.RatesPerAnnumNumber.Should().Be(10);
            vm.YearsNumber.Should().Be(10);
            vm.StartNumber.Should().Be(150000);
            vm.InterestNumber.Should().Be(2);
            vm.NominalInterestRateNumber.Should().BeApproximately(1.98, 0.01);
            vm.RateNumber.Should().Be(-340);
            vm.RepaymentRateNumber.Should().BeApproximately(0.28, 0.01);
            vm.EndNumber.Should().Be(10000);
        }
        public void P_BookP21()
        {
            var mockObjects = MockFactories.GetMockObjects();
            var vm          = MockFactories.FinCalcViewModelWithCalculatorImplementationFactory(mockObjects);

            vm.DigitPressedCommand.Execute(1);
            vm.OperatorPressedCommand.Execute("*");
            vm.YearsPressedCommand.Execute(false);
            vm.DigitPressedCommand.Execute(2);
            vm.DigitPressedCommand.Execute(5);
            vm.YearsPressedCommand.Execute(false);
            vm.DigitPressedCommand.Execute(2);
            vm.DigitPressedCommand.Execute(5);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.AlgebSignCommand.Execute(null);
            vm.StartPressedCommand.Execute(false);
            vm.DigitPressedCommand.Execute(1);
            vm.DigitPressedCommand.Execute(2);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.RatePressedCommand.Execute(false);
            vm.DigitPressedCommand.Execute(0);
            vm.EndPressedCommand.Execute(false);
            vm.InterestPressedCommand.Execute(false);

            Assert.True(vm.DisplayText == "1,455");
            Assert.True(Math.Abs(vm.DisplayNumber - 1.455) < this.Tolerance);
            Assert.True(Math.Abs(vm.InterestNumber - 1.455) < this.Tolerance);
            Assert.True(Math.Abs(vm.NominalInterestRateNumber - 1.455) < this.Tolerance);
        }
        public void N_BookP32()
        {
            var mockObjects = MockFactories.GetMockObjects();
            var vm          = MockFactories.FinCalcViewModelWithCalculatorImplementationFactory(mockObjects);

            vm.DigitPressedCommand.Execute(5);
            vm.DecimalSeparatorPressedCommand.Execute(null);
            vm.DigitPressedCommand.Execute(5);
            vm.InterestPressedCommand.Execute(false);
            vm.DigitPressedCommand.Execute(1);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.AlgebSignCommand.Execute(null);
            vm.StartPressedCommand.Execute(false);
            vm.DigitPressedCommand.Execute(5);
            vm.DigitPressedCommand.Execute(5);
            vm.DigitPressedCommand.Execute(0);
            vm.AlgebSignCommand.Execute(null);
            vm.RatePressedCommand.Execute(false);
            vm.DigitPressedCommand.Execute(1);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.EndPressedCommand.Execute(false);
            vm.YearsPressedCommand.Execute(false);

            Assert.True(vm.DisplayText == "39,85");
            Assert.True(Math.Abs(vm.DisplayNumber - 39.85) < this.Tolerance);
            Assert.True(Math.Abs(vm.YearsNumber - 39.85) < this.Tolerance);
        }
        public void Kn_Manual_LoanQuestion1()
        {
            var mockObjects = MockFactories.GetMockObjects();
            var vm          = MockFactories.FinCalcViewModelWithCalculatorImplementationFactory(mockObjects);

            vm.DigitPressedCommand.Execute(1);
            vm.DigitPressedCommand.Execute(2);
            vm.OperatorPressedCommand.Execute("*");
            vm.YearsPressedCommand.Execute(false);
            vm.DigitPressedCommand.Execute(1);
            vm.DigitPressedCommand.Execute(0);
            vm.YearsPressedCommand.Execute(false);
            vm.DigitPressedCommand.Execute(4);
            vm.OperatorPressedCommand.Execute("*");
            vm.InterestPressedCommand.Execute(false);
            vm.DigitPressedCommand.Execute(1);
            vm.DigitPressedCommand.Execute(5);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.StartPressedCommand.Execute(false);
            vm.DigitPressedCommand.Execute(2);
            vm.OperatorPressedCommand.Execute("*");
            vm.RatePressedCommand.Execute(false);
            vm.EndPressedCommand.Execute(false);

            Assert.True(vm.DisplayText == "-113.187,55");
            Assert.True(Math.Abs(vm.DisplayNumber - -113187.5488186329) < this.Tolerance);
            Assert.True(Math.Abs(vm.EndNumber - -113187.5488186329) < this.Tolerance);
        }
        public void E_BookP17()
        {
            var mockObjects = MockFactories.GetMockObjects();
            var vm          = MockFactories.FinCalcViewModelWithCalculatorImplementationFactory(mockObjects);

            vm.DigitPressedCommand.Execute(2);
            vm.DigitPressedCommand.Execute(5);
            vm.YearsPressedCommand.Execute(false);
            vm.DigitPressedCommand.Execute(7);
            vm.InterestPressedCommand.Execute(false);
            vm.DigitPressedCommand.Execute(0);
            vm.StartPressedCommand.Execute(false);
            vm.DigitPressedCommand.Execute(2);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.DigitPressedCommand.Execute(0);
            vm.EndPressedCommand.Execute(false);
            vm.RatePressedCommand.Execute(false);

            Assert.True(vm.DisplayText == "-255,41");
            Assert.True(Math.Abs(vm.DisplayNumber - -255.41) < this.Tolerance);
            Assert.True(Math.Abs(vm.RateNumber - -255.41) < this.Tolerance);
        }
示例#9
0
        public void CalculateAndDisplayE_GivenAllNeededVariables(bool advance, double m, double n, double p, double k0, double kn, double expectedE)
        {
            // Arrange
            var mockObjects = MockFactories.GetMockObjects();
            var vm          = MockFactories.FinCalcViewModelWithCalculatorImplementationFactory(mockObjects);

            // Since I am sharing the test data with the plain calculation tests I have to manually adjust this value:
            expectedE *= -1;

            // Act
            if (advance)
            {
                FinCalcViewModelHelper.ExecuteDummyAction(vm, Ca.ToggleAdv);
            }

            FinCalcViewModelHelper.SetFinancialValue(vm, m, CommandWord.SetRatesPerAnnum);
            FinCalcViewModelHelper.SetFinancialValue(vm, n, CommandWord.SetYears);
            FinCalcViewModelHelper.SetFinancialValue(vm, p, CommandWord.SetNominalInterestRate);
            FinCalcViewModelHelper.SetFinancialValue(vm, k0, CommandWord.SetStart);
            FinCalcViewModelHelper.SetFinancialValue(vm, kn, CommandWord.SetEnd);
            vm.RatePressedCommand.Execute(false);

            // Assert
            vm.DisplayNumber.Should().BeApproximately(expectedE, this.Tolerance);
        }
        public void SortedListOfMatchesByKeyIsCreated()
        {
            var mockObjects = MockFactories.GetMockObjects();

            var vm = MockFactories.DeepLinkCollectionViewModelFactory(mockObjects);

            vm.Sideload(MockedDeeplinkMatches.OrderTestList, DeepLinkSortOrder.Key);

            var firstLevelOneItem = vm.HierarchicalLinks.First();
            var lastLevelOneItem  = vm.HierarchicalLinks.Last();

            Assert.Equal("Key1", firstLevelOneItem.Name);
            Assert.Equal("Cat1", firstLevelOneItem.SecondLinkHierarchies.First().Name);
            Assert.Equal("Cat2", firstLevelOneItem.SecondLinkHierarchies.Last().Name);
            Assert.Equal("Key3", lastLevelOneItem.Name);
            Assert.Equal("Cat1", lastLevelOneItem.SecondLinkHierarchies.First().Name);
            Assert.Equal("Cat2", lastLevelOneItem.SecondLinkHierarchies.Last().Name);

            vm.Sideload(MockedDeeplinkMatches.OrderTestList, DeepLinkSortOrder.Key, true);

            firstLevelOneItem = vm.HierarchicalLinks.First();
            lastLevelOneItem  = vm.HierarchicalLinks.Last();

            Assert.Equal("Key3", firstLevelOneItem.Name);
            Assert.Equal("Cat2", firstLevelOneItem.SecondLinkHierarchies.First().Name);
            Assert.Equal("Cat1", firstLevelOneItem.SecondLinkHierarchies.Last().Name);
            Assert.Equal("Key1", lastLevelOneItem.Name);
            Assert.Equal("Cat2", lastLevelOneItem.SecondLinkHierarchies.First().Name);
            Assert.Equal("Cat1", lastLevelOneItem.SecondLinkHierarchies.Last().Name);
        }
示例#11
0
        public void CorrectNumberOfEntriesIsPublished(string testText, bool multipleRows, int maxMultipleRows, int expectedEntriesCount)
        {
            var mockObjects          = MockFactories.GetMockObjects();
            var clipboardConfig      = Mock.Get((IClipboardConfiguration)mockObjects[nameof(IClipboardConfiguration)]);
            var sharpClipboardMapper = Mock.Get((ISharpClipboardMapper)mockObjects[nameof(ISharpClipboardMapper)]);
            var textCopyMapper       = Mock.Get((ITextCopyMapper)mockObjects[nameof(ITextCopyMapper)]);

            clipboardConfig.SetupGet(x => x.MaxProcessedRows).Returns(maxMultipleRows);
            clipboardConfig.SetupGet(x => x.ProcessMultipleRows).Returns(multipleRows);

            var clipboardManager = MockFactories.ClipboardManagerFactory(mockObjects);

            clipboardManager.AppName = "testApp2";
            var eventCorrectRaised = false;

            clipboardManager.ClipboardTextUpdateReceived += (s, e) =>
            {
                eventCorrectRaised = e.ClipboardEntries.Length == expectedEntriesCount;
            };

            sharpClipboardMapper.Raise(
                x => x.ClipboardChanged += null,
                this,
                new ClipboardChangedEventArgs(
                    applicationName: "testApp",
                    clipboardContent: testText,
                    contentType: SharpClipboard.ContentTypes.Text));

            Assert.True(eventCorrectRaised);
        }
        public void ListThresholdIsHandled()
        {
            var mockObjects = MockFactories.GetMockObjects();

            var vm = MockFactories.DeepLinkHistoryViewModelFactory(mockObjects);

            for (int i = 1; i <= 10; i++)
            {
                vm.Handle(new DeepLinkMatchesUpdatedEvent(
                              new List <DeepLinkMatch>()
                {
                    new DeepLinkMatch(),
                },
                              "test" + i));
            }

            Assert.Equal(10, vm.HistoryEntryList.Count);

            vm.Handle(new DeepLinkMatchesUpdatedEvent(
                          new List <DeepLinkMatch>()
            {
                MockedDeeplinkMatches.SimpleDeepLinkMatch,
            },
                          "test100"));

            Assert.Equal(10, vm.HistoryEntryList.Count);
            Assert.Equal("test2", vm.HistoryEntryList.Last().DeepLinkMatchValue);
            Assert.Equal("test100", vm.HistoryEntryList.First().DeepLinkMatchValue);
        }
        public void HaveSetVersionText_WhenVmIsLoaded()
        {
            // Arrange
            var vm = MockFactories.AboutViewModelFactory(out _);

            // Act
            // Assert
            vm.AppVersionText.Should().NotBeNullOrWhiteSpace();
        }
示例#14
0
        public void UploadFor_should_generate_expected_html_code()
        {
            var helper        = MockFactories.CreateFakeHtmlHelper <DummyViewModel>();
            var mvcHtmlString = UploadExtensions.UploadFor(helper, model => model.TheFile);
            var generatedHtml = mvcHtmlString.ToString();
            var expectedHtml  = "<input id=\"TheFile\" name=\"TheFile\" type=\"file\" />";

            Assert.AreEqual <string>(expectedHtml, generatedHtml);
        }
示例#15
0
        public void Upload_should_generate_expected_html_code()
        {
            var helper        = MockFactories.CreateFakeHtmlHelper();
            var mvcHtmlString = UploadExtensions.Upload(helper, "myfile");
            var generatedHtml = mvcHtmlString.ToString();
            var expectedHtml  = "<input id=\"myfile\" name=\"myfile\" type=\"file\" />";

            Assert.AreEqual <string>(expectedHtml, generatedHtml);
        }
示例#16
0
        public void UploadFor_should_generate_expected_html_code_and_attributes_when_attributes_are_specified_using_anonymous_type()
        {
            var helper        = MockFactories.CreateFakeHtmlHelper <DummyViewModel>();
            var attributes    = new { @class = "fake", style = "text-align: left;" };
            var mvcHtmlString = UploadExtensions.UploadFor(helper, model => model.TheFile, attributes);
            var generatedHtml = mvcHtmlString.ToString();
            var expectedHtml  = "<input class=\"fake\" id=\"TheFile\" name=\"TheFile\" style=\"text-align: left;\" type=\"file\" />";

            Assert.AreEqual <string>(expectedHtml, generatedHtml);
        }
示例#17
0
        public void MenuItemChangesAreHandled()
        {
            var mockObjects = MockFactories.GetMockObjects();

            var vm = MockFactories.ShellViewModelFactory(mockObjects);

            vm.MenuItemsSelectionChangedCommand.Execute(null);

            Assert.False(vm.IsMenuBarVisible);
        }
示例#18
0
        public void VmIsSubscribedToEventAggregator()
        {
            var mockObjects         = MockFactories.GetMockObjects();
            var eventAggregatorMock = Mock.Get((IEventAggregator)mockObjects[nameof(IEventAggregator)]);

            var vm = MockFactories.ShellViewModelFactory(mockObjects);

            // Test to make sure subscribe was called on the event aggregator at least once
            eventAggregatorMock.Verify(x => x.Subscribe(vm), Times.Once);
        }
示例#19
0
        public void WindowGetsMinimized()
        {
            var mockObjects = MockFactories.GetMockObjects();

            var vm = MockFactories.ShellViewModelFactory(mockObjects);

            vm.MinimizeAppCommand.Execute(null);

            Assert.Equal(WindowState.Minimized, vm.CurWindowState);
        }
示例#20
0
        public void TextIsCopiedToClipboard()
        {
            var mockObjects    = MockFactories.GetMockObjects();
            var textCopyMapper = Mock.Get((ITextCopyMapper)mockObjects[nameof(ITextCopyMapper)]);

            var clipboardManager = MockFactories.ClipboardManagerFactory(mockObjects);

            clipboardManager.CopyTextToClipboard("test");

            textCopyMapper.Verify(x => x.SetText(It.IsAny <string>()), Times.Once);
        }
示例#21
0
        public void TitleBarDoubleClicksChangesWindowState()
        {
            var mockObjects = MockFactories.GetMockObjects();

            var vm = MockFactories.ShellViewModelFactory(mockObjects);

            var curState = vm.CurWindowState;

            vm.TitleBarDoubleClickedCommand.Execute(null);

            Assert.NotEqual(curState, vm.CurWindowState);
        }
        internal static void ExecuteDummyActionsAndCheckOutput(Ca[] actions, string expectedOutputTextAfterAllOperations, double expectedNumberAfterAllOperations, double precision, FinCalcViewModel vm = null)
        {
            // Arrange
            vm = vm ?? MockFactories.FinCalcViewModelWithCalculatorImplementationFactory(out _);

            // Act
            ExecuteDummyActions(vm, actions);

            // Assert
            vm.DisplayText.Should().Be(expectedOutputTextAfterAllOperations);
            vm.DisplayNumber.Should().BeApproximately(expectedNumberAfterAllOperations, precision);
        }
        public void DefaultBrowserIsSelectedEvenWhenNoBrowserIsSetAsDefault()
        {
            var mockObjects   = MockFactories.GetMockObjects();
            var browserConfig = Mock.Get((IBrowserConfiguration)mockObjects[nameof(IBrowserConfiguration)]);

            browserConfig.SetupGet(x => x.BrowserDefinitions).Returns(MockedBrowserDefinitions.BrowserDefinitionsWithoutDefaultBrowser);

            var browserManager = MockFactories.BrowserManagerFactory(mockObjects);

            Assert.False(browserManager.DefaultBrowserDefinition.IsDefault);
            Assert.True(browserManager.DefaultBrowserDefinition.Name == "test");
        }
示例#24
0
        public void ActivateSecondFunctionTrigger_WhenActiveOperatorIsAdd()
        {
            // Arrange
            var mockObjects = MockFactories.GetMockObjects();
            var vm          = MockFactories.FinCalcViewModelWithCalculatorImplementationFactory(mockObjects);

            // Act
            vm.OperatorPressedCommand.Execute("*");

            // Assert
            vm.SecondFunctionTrigger.Should().BeTrue();
        }
示例#25
0
        public async Task ErrorEventsAreHandled()
        {
            var mockObjects = MockFactories.GetMockObjects();

            // var dialogHostMapper = Mock.Get((IDialogHostMapper)mockObjects[nameof(IDialogHostMapper)]);
            var snackbarMock = Mock.Get((ISnackbarMessageQueue)mockObjects[nameof(ISnackbarMessageQueue)]);
            var vm           = MockFactories.ShellViewModelFactory(mockObjects);

            await vm.Handle(new ErrorEvent(new Exception(), "test"));

            // dialogHostMapper.Verify(x => x.Show(It.IsAny<object>(), It.IsAny<object>()), Times.Once);
            snackbarMock.Verify(x => x.Enqueue(It.IsAny <object>(), It.IsAny <object>(), It.IsAny <Action <ErrorEvent> >(), It.IsAny <ErrorEvent>()), Times.Once);
        }
示例#26
0
        public void HotKeyIsRegistered()
        {
            var mockObjects   = MockFactories.GetMockObjects();
            var hotkeyManager = Mock.Get((INHotkeyManagerMapper)mockObjects[nameof(INHotkeyManagerMapper)]);

            hotkeyManager.Setup(x =>
                                x.AddOrReplace(It.IsAny <string>(), It.IsAny <Key>(), It.IsAny <ModifierKeys>()));

            var vm = MockFactories.ShellViewModelFactory(mockObjects);

            // Test to make sure subscribe was called on the event aggregator at least once
            hotkeyManager.Verify(x => x.AddOrReplace(It.IsAny <string>(), It.IsAny <Key>(), It.IsAny <ModifierKeys>()), Times.Once);
        }
        public void CopyingToClipboardIsHandled()
        {
            var mockObjects          = MockFactories.GetMockObjects();
            var clipboardManagerMock = Mock.Get((IClipboardManager)mockObjects[nameof(IClipboardManager)]);

            clipboardManagerMock.Setup(x => x.CopyTextToClipboard(It.IsAny <string>())).Verifiable();

            var vm = MockFactories.DeepLinkCollectionViewModelFactory(mockObjects);

            vm.CopyLinkToClipboardCommand.Execute("test");

            clipboardManagerMock.Verify(x => x.CopyTextToClipboard(It.IsAny <string>()), Times.Once);
        }
        public void UrlOpeningWithDefaultBrowserSucceeds()
        {
            var mockObjects   = MockFactories.GetMockObjects();
            var proxyMock     = Mock.Get((IProcessProxy)mockObjects[nameof(IProcessProxy)]);
            var browserConfig = Mock.Get((IBrowserConfiguration)mockObjects[nameof(IBrowserConfiguration)]);

            browserConfig.SetupGet(x => x.BrowserDefinitions).Returns(MockedBrowserDefinitions.BrowserDefinitions);

            var browserManager = MockFactories.BrowserManagerFactory(mockObjects);

            browserManager.OpenWithDefaultBrowser("test");

            proxyMock.Verify(x => x.StartProcess(It.IsAny <ProcessStartInfo>()));
        }
示例#29
0
        public void Upload_method_should_throw_ArgumentException_if_name_parameter_is_whitespace()
        {
            var helper = MockFactories.CreateFakeHtmlHelper();

            Executing.This(() => UploadExtensions.Upload(helper, "   "))
            .Should()
            .Throw <ArgumentException>()
            .And
            .ValueOf
            .ParamName
            .Should()
            .Be
            .EqualTo("name");
        }
        public void TextboxUpdatesThatDoNotMatchAreProcessed()
        {
            var mockObjects = MockFactories.GetMockObjects();

            var deeplinkManagerMock = Mock.Get((IDeepLinkManager)mockObjects[nameof(IDeepLinkManager)]);

            deeplinkManagerMock.Setup(x => x.GetDeepLinkMatches(It.IsAny <string>())).Returns((List <DeepLinkMatch>)null);

            var vm = MockFactories.DeepLinkCollectionViewModelFactory(mockObjects);

            vm.ApplyInputCommand.Execute("test");

            Assert.Empty(vm.HierarchicalLinks);
        }