protected void Configure() { var mockEventAggregator = new MockEventAggregator(); var mockSubsonicService = new MockSubsonicService(); var mockNavigationService = new MockNavigationService(); var mockNotificationService = new MockToastNotificationService(); var mockDialogNotificationService = new MockDialogNotificationService(); var mockStorageService = new MockStorageService(); var mockWinRTWrappersService = new MockWinRTWrappersService(); var shellViewModel = new ShellViewModel(mockEventAggregator, mockSubsonicService, mockNavigationService, mockNotificationService, mockDialogNotificationService, mockStorageService, mockWinRTWrappersService); IoC.GetInstance = (type, s) => { object instance = null; if (type == typeof(IShellViewModel)) { instance = shellViewModel; } else if (type == typeof(ISubsonicService)) { instance = mockSubsonicService; } return instance; }; }
public void Setup() { _mockSubsonicService = new MockSubsonicService(); _mockStorageService = new MockStorageService(); _mockToastNotificationService = new MockToastNotificationService(); _mockNavigationService = new MockNavigationService(); _subject = new SettingsViewModel(_mockSubsonicService, _mockToastNotificationService, _mockStorageService, _mockNavigationService); }
private void SetupStorage(string name, MockStorageService.StorageAccountData a) { a.Name = name; a.BlobEndpoint = "http://awesome.blob.core.windows.net/"; a.QueueEndpoint = "http://awesome.queue.core.windows.net/"; a.TableEndpoint = "http://awesome.table.core.windows.net/"; a.PrimaryKey = "MNao3bm7t7B/x+g2/ssh9HnG0mEh1QV5EHpcna8CetYn+TSRoA8/SBoH6B3Ufwtnz3jZLSw9GEUuCTr3VooBWq=="; a.SecondaryKey = "secondaryKey"; }
public void TestSetup() { GlobalPathInfo.GlobalSettingsDirectory = Data.AzureSdkAppDir; storageService = new MockStorageService() .Add(a => SetupStorage(serviceName.ToLowerInvariant(), a)) .Add(a => SetupStorage(storageName.ToLowerInvariant(), a)); services = new MockServicesHost() .Add(s => { s.Name = serviceName; s.AddDeployment(d => { d.Slot = DeploymentSlot.Production; d.Name = "mydeployment"; }); }); subscription = new WindowsAzureSubscription { Certificate = It.IsAny <X509Certificate2>(), IsDefault = true, ServiceEndpoint = new Uri("https://www.azure.com"), SubscriptionId = Guid.NewGuid().ToString(), SubscriptionName = Data.Subscription1, }; cloudBlobUtilityMock = new Mock <CloudBlobUtility>(); cloudBlobUtilityMock.Setup(f => f.UploadPackageToBlob( It.IsAny <StorageManagementClient>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <BlobRequestOptions>())).Returns(new Uri("http://www.packageurl.azure.com")); clientMocks = new ClientMocks(subscription.SubscriptionId); services.InitializeMocks(clientMocks.ComputeManagementClientMock); storageService.InitializeMocks(clientMocks.StorageManagementClientMock); client = new CloudServiceClient(subscription, clientMocks.ManagementClientMock.Object, clientMocks.StorageManagementClientMock.Object, clientMocks.ComputeManagementClientMock.Object ) { CloudBlobUtility = cloudBlobUtilityMock.Object }; }
public void Setup() { _mockSubsonicService = new MockSubsonicService(); _mockStorageService = new MockStorageService(); _mockToastNotificationService = new MockToastNotificationService(); _mockNavigationService = new MockNavigationService(); _mockSettingsHelper = new MockSettingsHelper(); _subject = new SettingsViewModel( _mockSubsonicService, _mockToastNotificationService, _mockStorageService, _mockNavigationService) { SettingsHelper = _mockSettingsHelper }; }
public void TestInitialize() { IoC.GetInstance = (type, s) => null; _mockSubsonicService = new MockSubsonicService(); _mockNavigationService = new MockNavigationService(); _mockToastNotificationService = new MockToastNotificationService(); _mockDialogNotificationService = new MockDialogNotificationService(); _mockStorageService = new MockStorageService(); _mockWinRTWrappersService = new MockWinRTWrappersService(); _mockPlayerControls = new MockPlayerControls(); Subject = new ShellViewModel(_eventAggregator, _mockSubsonicService, _mockNavigationService, _mockToastNotificationService, _mockDialogNotificationService, _mockStorageService, _mockWinRTWrappersService) { PlayerControls = _mockPlayerControls }; }
public void TestInitialize() { IoC.GetInstance = (type, s) => null; _mockEventAggregator = new MockEventAggregator(); _mockSubsonicService = new MockSubsonicService(); _mockNavigationService = new MockNavigationService(); _mockToastNotificationService = new MockToastNotificationService(); _mockDialogNotificationService = new MockDialogNotificationService(); _mockStorageService = new MockStorageService(); _mockWinRTWrappersService = new MockWinRTWrappersService(); _mockErrorDialogViewModel = new MockErrorDialogViewModel(); Subject = new ShellViewModel { EventAggregator = _mockEventAggregator, SubsonicService = _mockSubsonicService, NavigationService = _mockNavigationService, NotificationService = _mockToastNotificationService, DialogNotificationService = _mockDialogNotificationService, StorageService = _mockStorageService, WinRTWrappersService = _mockWinRTWrappersService, ErrorDialogViewModel = _mockErrorDialogViewModel }; }
protected void Configure() { var mockEventAggregator = new MockEventAggregator(); var mockSubsonicService = new MockSubsonicService(); var mockNavigationService = new MockNavigationService(); var mockNotificationService = new MockToastNotificationService(); var mockDialogNotificationService = new MockDialogNotificationService(); var mockStorageService = new MockStorageService(); var mockWinRTWrappersService = new MockWinRTWrappersService(); var mockErrorDialogViewModel = new MockErrorDialogViewModel(); var shellViewModel = new ShellViewModel { EventAggregator = mockEventAggregator, SubsonicService = mockSubsonicService, NavigationService = mockNavigationService, NotificationService = mockNotificationService, DialogNotificationService = mockDialogNotificationService, StorageService = mockStorageService, WinRTWrappersService = mockWinRTWrappersService, ErrorDialogViewModel = mockErrorDialogViewModel }; IoC.GetInstance = (type, s) => { object instance = null; if (type == typeof(IShellViewModel)) { instance = shellViewModel; } else if (type == typeof(ISubsonicService)) { instance = mockSubsonicService; } return(instance); }; }
public void TestSetup() { GlobalPathInfo.GlobalSettingsDirectory = Data.AzureSdkAppDir; storageService = new MockStorageService() .Add(a => SetupStorage(serviceName.ToLowerInvariant(), a)) .Add(a => SetupStorage(storageName.ToLowerInvariant(), a)); services = new MockServicesHost() .Add(s => { s.Name = serviceName; s.AddDeployment(d => { d.Slot = DeploymentSlot.Production; d.Name = "mydeployment"; }); }); subscription = new WindowsAzureSubscription { Certificate = It.IsAny<X509Certificate2>(), IsDefault = true, ServiceEndpoint = new Uri("https://www.azure.com"), SubscriptionId = Guid.NewGuid().ToString(), SubscriptionName = Data.Subscription1, }; cloudBlobUtilityMock = new Mock<CloudBlobUtility>(); cloudBlobUtilityMock.Setup(f => f.UploadPackageToBlob( It.IsAny<StorageManagementClient>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<BlobRequestOptions>())).Returns(new Uri("http://www.packageurl.azure.com")); clientMocks = new ClientMocks(subscription.SubscriptionId); services.InitializeMocks(clientMocks.ComputeManagementClientMock); storageService.InitializeMocks(clientMocks.StorageManagementClientMock); client = new CloudServiceClient(subscription, clientMocks.ManagementClientMock.Object, clientMocks.StorageManagementClientMock.Object, clientMocks.ComputeManagementClientMock.Object ) { CloudBlobUtility = cloudBlobUtilityMock.Object }; }