Example #1
0
        public MainViewModelTests()
        {
            _predictor = Substitute.For <IPredictor>();
            _predictor
            .PredictAsync(Arg.Any <Stream>())
            .Returns(new PredictionResult
            {
                Success        = true,
                Answer         = "Test result",
                PredictionTime = new DateTime(2000, 1, 1)
            });

            _displayAlertProvider = Substitute.For <IDisplayAlertProvider>();

            _mediaFile = new MediaFile(
                "/files/testfile",
                () => new MemoryStream(),
                () => new MemoryStream());

            _media = Substitute.For <IMedia>();
            _media.Initialize().Returns(Task.FromResult(true));
            _media.IsPickPhotoSupported.Returns(true);
            _media.IsTakePhotoSupported.Returns(true);
            _media.IsCameraAvailable.Returns(true);
            _media.PickPhotoAsync(Arg.Any <PickMediaOptions>()).Returns(Task.FromResult(_mediaFile));
            _media.TakePhotoAsync(Arg.Any <StoreCameraMediaOptions>()).Returns(Task.FromResult(_mediaFile));

            _mediaProvider = Substitute.For <IMediaProvider>();
            _mediaProvider.Media.Returns(_media);
        }