コード例 #1
0
        public void SaveSettings_NullSettings()
        {
            var sut = SetupVM();

            sut.SaveSettingsCommand.Execute(null);

            PopUpsMock.Verify(x => x.ShowToast("Could not save settings...try again"));
        }
コード例 #2
0
        public void InitGPIOs_WithBadUri()
        {
            httpClientMock.Setup(x => x.HostAvailable(It.IsAny <Uri>())).Returns(Task.FromResult(true)); //should never return true from bad uri, but best testing the case.
            settingAccessMock.Setup(x => x.GetSettings()).Returns(TestHelper.GetBadMockSettingsData());
            var sut = CreateViewModel();

            sut.OnAppearingCommand.Execute(null);

            PopUpsMock.Verify(x => x.ShowToast("Base URL httqwqdp://192.168.0._43422:80d80/ is an incorrect URL Format"), Times.Once);
        }
コード例 #3
0
        public void DriveRover_WithBadUri_AndbadBaseURI()
        {
            httpClientMock.Setup(x => x.HostAvailable(It.IsAny <Uri>())).Returns(Task.FromResult(true)); //should never return true from bad uri, but best testing the case.
            settingAccessMock.Setup(x => x.GetSettings()).Returns(TestHelper.GetBadMockSettingsData());
            var sut = CreateViewModel();

            sut.OnAppearingCommand.Execute(null);

            sut.GoForwardsCommand.Execute(null);
            PopUpsMock.Verify(x => x.ShowToast("No base URL Found...is it in the Correct Format?"), Times.Once);
        }
コード例 #4
0
        public void DriveRover_WhileAttemptingToConnect()
        {
            var mockSettings = TestHelper.GetMockSettingsData().ToList();

            settingAccessMock.Setup(x => x.GetSettings()).Returns(mockSettings);

            var sut = CreateViewModel();

            sut.OnAppearingCommand.Execute(null);
            sut.RoverConnection = RoverConnection.Trying_To_Connect;

            sut.GoForwardsCommand.Execute(null);
            sut.GoBackwardsCommand.Execute(null);
            sut.GoLeftCommand.Execute(null);
            sut.GoLeftCommand.Execute(null);
            sut.GoRightCommand.Execute(null);
            sut.GoRightCommand.Execute(null);
            sut.StopForwardsAndBackwardCommand.Execute(null);

            PopUpsMock.Verify(x => x.ShowToast("Cannot Drive - Trying to Connect to Rover"), Times.Exactly(7));
            httpClientMock.Verify(x => x.GetAsync(It.IsAny <Uri>()), Times.Never);
        }