public async Task TestConstructor_ReturnsNullNameForExceptionCreatingDataSource() { DataSourceFactoryMock.Setup(dsf => dsf.CreatePlusDataSource(It.IsAny <GoogleCredential>())) .Throws <Exception>(); var objectUnderTest = new UserAccountViewModel(s_defaultUserAccount); await objectUnderTest.NameAsync.SafeTask; Assert.IsTrue(objectUnderTest.NameAsync.IsCompleted); Assert.IsNull(objectUnderTest.NameAsync.Value); }
protected override void BeforeEach() { _gPlusDataSourceMock = new Mock <IGPlusDataSource>(); _mockedResourceManagerDataSource = null; _mockedGPlusDataSource = null; DataSourceFactoryMock.Setup(f => f.CreateResourceManagerDataSource()) .Returns(() => _mockedResourceManagerDataSource); DataSourceFactoryMock.Setup(f => f.CreatePlusDataSource()).Returns(() => _mockedGPlusDataSource); _mockedSelectionUtils = Mock.Of <ISelectionUtils>(); _objectUnderTest = new CloudExplorerViewModel(_mockedSelectionUtils); _propertiesChanged = new SynchronizedCollection <string>(); _objectUnderTest.PropertyChanged += (sender, args) => _propertiesChanged.Add(args.PropertyName); }
protected override void BeforeEach() { _getProfileTaskSource = new TaskCompletionSource <Person>(); DataSourceFactoryMock.Setup(dsf => dsf.CreatePlusDataSource(It.IsAny <GoogleCredential>()).GetProfileAsync()) .Returns(_getProfileTaskSource.Task); }