public void WhenTypeAttributeIsNotFound_ThenThrows() { var processor = new ModelElementDirectiveProcessor(); processor.StartProcessingRun(provider, null, new CompilerErrorCollection()); Assert.Throws <DirectiveProcessorException>(() => processor.ProcessDirective("ModelElement", new Dictionary <string, string>())); }
public void WhenPropertyNameIsNull_ThenEvaluateFalse() { var mockEvent = new Mock <IEvent <PropertyChangedEventArgs> >(); this.condition.Event = mockEvent.Object; Assert.Throws <ValidationException>(() => this.condition.Evaluate()); }
public void WhenInitializingAndExttensionPathIsNull_ThenThrowsArgumentNullException() { var content = new Mock <IExtensionContent>(); content.Setup(c => c.RelativePath).Returns("foo.patterndefinition"); content.Setup(c => c.Attributes).Returns(new Dictionary <string, string>() { { "AssemblyFile", "bar.dll" } }); Assert.Throws <ArgumentNullException>(() => new SchemaResource(null, content.Object)); }
public void WhenGettingOutputAssembly_ThenCanInspectAssemblyUsingReflection() { base.OpenSolution("SampleSolution\\SampleSolution.sln"); var explorer = base.ServiceLocator.GetInstance <ISolutionExplorer>(); var lib = explorer.Solution.Traverse().OfType <IProjectNode>() .FirstOrDefault(node => node.DisplayName == "ClassLibrary"); var asm = lib.GetOutputAssembly().Result; var type = asm.GetTypes().First(t => t.GetConstructor(new Type[0]) != null); Assert.Throws <ArgumentException>(() => Activator.CreateInstance(type)); }
public void WhenConstructedWithNullAction_ThenThrowsArgumentNullException() { Assert.Throws <ArgumentNullException>(() => { using (new AnonymousDisposable(null)) { } }); }
public void WhenSourceIsNullWithOnNext_ThenThrowsArgumentNullException() { IObservable <IEvent <EventArgs> > source = null; Assert.Throws <ArgumentNullException>(() => source.Subscribe(e => { })); }
public void WhenValueProviderBindingFails_ThenThrowsInvalidOperationExceptionAndTraces() { var settings = new PropertyBindingSettings { ValueProvider = new ValueProviderBindingSettings { } }; Mock.Get(this.binding) .Setup(x => x.Evaluate(It.IsAny <IDynamicBindingContext>())) .Returns(false); Assert.Throws <InvalidOperationException>(() => settings.Evaluate(this.bindingFactory, this.tracer)); Mock.Get(this.tracer) .Verify(x => x.Trace(TraceEventType.Error, It.IsAny <string>(), It.IsAny <object[]>())); }
public void WhenRetrievingExportedValueOrDefaultForMany_ThenThrowsImportCardinalityException() { var components = GlobalServiceProvider.Instance.GetService <SComponentModel, IComponentModel>(); // ICompletionSourceProvider has many exports. // On VS2010 this throws, but on VS2012+ it succeeds and returns null :S #if Vs10 Assert.Throws <ImportCardinalityMismatchException>(() => components.DefaultExportProvider.GetExportedValueOrDefault <ICompletionSourceProvider>()); #endif #if Vs11 || Vs12 Assert.Equal <ICompletionSourceProvider>(null, components.DefaultExportProvider.GetExportedValueOrDefault <ICompletionSourceProvider>()); #endif }
public void WhenResolvingNullUri_ThenThrowsException() { Assert.Throws <ArgumentNullException>( () => this.provider.ResolveUri(null)); }
public void WhenGettingName_ThenExceptionIsThrown() { Assert.Throws <InvalidOperationException>(() => this.patternModel.GetUniqueName("Foo")); }
public void WhenCreatingNewWithNullServiceProvider_ThenThrowsArgumentNullException() { Assert.Throws <ArgumentNullException>(() => new ProxyServiceProvider(null)); }
public void WhenCreatingACloner_ThenNullExceptionIsThrown() { Assert.Throws <ArgumentNullException>(() => new PatternModelCloner(null, null, null)); }
public void WhenCreatingAClonerWithNullTargetPatternModel_ThenNullExceptionIsThrown() { Assert.Throws <ArgumentNullException>( () => new PatternModelCloner(this.sourcePatternModel, new Version("1.0.0.0"), null)); }
public void WhenResolveUriWithNullUri_ThenThrows() { Assert.Throws <NullReferenceException>(() => this.service.ResolveUri <IItemContainer>(null)); }
public void WhenGettingNameWithNull_ThenExceptionIsThrown() { Assert.Throws <ArgumentNullException>(() => this.patternModel.GetUniqueName(null)); }
public void WhenInitializingWithANullExtension_ThenThrowsArgumentNullException() { Assert.Throws <ArgumentNullException>(() => new InstalledToolkitInfo(this.extension, this.reader, this.resource)); }
public void WhenEnumerableIsNull_ThenThrowsArgumentNullException() { Assert.Throws <ArgumentNullException>(() => EnumerableExtensions.ForEach <string>(null, s => { })); }
public void WhenCreatingWithNullSender_ThenThrowsArgumentNullException() { Assert.Throws <ArgumentNullException>(() => Event.Create <EventArgs>(null, EventArgs.Empty)); }
public void WhenFindingWithNullManager_ThenThrowsArgumentNullException() { Assert.Throws <ArgumentNullException>(() => PatternManagerExtensions.Find(null, "foo")); }
public void WhenCreatingMenuCommandAndCommandIsNull_ThenThrowsArgumentNullException() { Assert.Throws <ArgumentNullException>(() => new VsMenuCommandAdapter(null)); }
public void WhenFindToolkitOrThrowWithUnknownTemplate_ThenThrows() { Assert.Throws <InvalidOperationException>(() => InstantiationTemplateWizard.FindToolkitOrThrow(this.manager, @"C:\undefined.vstemplate")); }
public void WhenPatternManagerIsNotOpen_ThenThrowsInvalidOperationException() { Mock.Get(this.Command.PatternManager).Setup(x => x.IsOpen).Returns(false); Assert.Throws <InvalidOperationException>(Resources.GenerateProductCodeCommand_PatternManagerNotOpen, () => Command.Execute()); }
public void WhenCreatingWithNullServiceProvider_ThenThrowsException() { Assert.Throws <ArgumentNullException>(() => new VsTemplateUriProvider(null)); }
public void WhenNullAddHandler_ThenThrowsArgumentNullException() { Assert.Throws <ArgumentNullException>(() => WeakObservable.FromEvent <EventArgs>(null, handler => { })); }
public void WhenLoadingAModelWithNullStream_ThenNullExceptionIsThrown() { Assert.Throws <ArgumentNullException>(() => PatternModelSerializationHelper.Instance.LoadModel(this.store, null, null, null)); }
public void WhenGettingOtherContentWithNullContentType_ThenThrowsArgumentNullException() { Assert.Throws <ArgumentNullException>(() => this.target.GetCustomExtensions(null)); }