示例#1
0
        private static ItemNewViewModel ItemNewViewModel_WithMockDependencies(out Mock <INavigationService> mockNavigationService, Mock <IItemsService> mockItemsService)
        {
            mockNavigationService = new Mock <INavigationService>();
            var mockDialogService   = new Mock <IDialogService>();
            var mockLocationService = new Mock <ILocationsService>();
            var itemNewViewModel    = new ItemNewViewModel(mockNavigationService.Object, mockDialogService.Object, mockItemsService.Object, mockLocationService.Object);

            return(itemNewViewModel);
        }
示例#2
0
        private static ItemNewViewModel ItemNewViewModel_WithMockDependencies_And_FakeRepository(out FakeItemsRepository mockItemsRepository)
        {
            var mockNavigationService = new Mock <INavigationService>();
            var mockDialogService     = new Mock <IDialogService>();

            mockItemsRepository = new FakeItemsRepository();
            var mockItemsService    = new ItemsService(mockItemsRepository, new InMemoryBlobCache());
            var mockLocationService = new Mock <ILocationsService>();
            var itemNewViewModel    = new ItemNewViewModel(mockNavigationService.Object, mockDialogService.Object, mockItemsService, mockLocationService.Object);

            return(itemNewViewModel);
        }
        private static async Task <ItemNewViewModel> MockFakeItemNewViewModel()
        {
            var mockNavigationService = new Mock <INavigationService>();
            var mockDialogService     = new Mock <IDialogService>();
            var mockItemsService      = new Mock <IItemsService>();
            var mockLocationService   = new Mock <ILocationsService>();

            var fakeItemsList = Task.Run(() =>
                                         new List <ItemSimpleDto>()
            {
                new ItemSimpleDto()
                {
                    Id = 1, Name = "Test 1"
                },
                new ItemSimpleDto()
                {
                    Id = 3, Name = "Test 3"
                },
                new ItemSimpleDto()
                {
                    Id = 5, Name = "Test 5"
                },
                new ItemSimpleDto()
                {
                    Id = 6, Name = "Test 6"
                },
                new ItemSimpleDto()
                {
                    Id = 61, Name = "test 61"
                },
                new ItemSimpleDto()
                {
                    Id = 500, Name = "TeBst 500"
                },
                new ItemSimpleDto()
                {
                    Id = 600, Name = "TeBst 600"
                },
                new ItemSimpleDto()
                {
                    Id = 10, Name = "BTest 10"
                },
                new ItemSimpleDto()
                {
                    Id = 30, Name = "BTest 30"
                },
                new ItemSimpleDto()
                {
                    Id = 50, Name = "BTest 50"
                },
                new ItemSimpleDto()
                {
                    Id = 60, Name = "BTest 60"
                }
            }
                                         );

            mockItemsService.Setup(m => m.GetAllItemsNameAsync()).Returns(fakeItemsList);
            var itemNewViewModel =
                new ItemNewViewModel(mockNavigationService.Object, mockDialogService.Object, mockItemsService.Object, mockLocationService.Object);
            await itemNewViewModel.InitializeAsync(null);

            return(itemNewViewModel);
        }