public void WhenTypeAttributeIsNotFound_ThenThrows()
        {
            var processor = new ModelElementDirectiveProcessor();

            processor.StartProcessingRun(provider, null, new CompilerErrorCollection());
            Assert.Throws <DirectiveProcessorException>(() => processor.ProcessDirective("ModelElement", new Dictionary <string, string>()));
        }
예제 #2
0
        public void WhenPropertyNameIsNull_ThenEvaluateFalse()
        {
            var mockEvent = new Mock <IEvent <PropertyChangedEventArgs> >();

            this.condition.Event = mockEvent.Object;

            Assert.Throws <ValidationException>(() => this.condition.Evaluate());
        }
예제 #3
0
        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));
        }
예제 #5
0
 public void WhenConstructedWithNullAction_ThenThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         using (new AnonymousDisposable(null))
         {
         }
     });
 }
예제 #6
0
        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[]>()));
        }
예제 #8
0
        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"));
 }
예제 #11
0
 public void WhenCreatingNewWithNullServiceProvider_ThenThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => new ProxyServiceProvider(null));
 }
예제 #12
0
 public void WhenCreatingACloner_ThenNullExceptionIsThrown()
 {
     Assert.Throws <ArgumentNullException>(() => new PatternModelCloner(null, null, null));
 }
예제 #13
0
 public void WhenCreatingAClonerWithNullTargetPatternModel_ThenNullExceptionIsThrown()
 {
     Assert.Throws <ArgumentNullException>(
         () => new PatternModelCloner(this.sourcePatternModel, new Version("1.0.0.0"), null));
 }
예제 #14
0
 public void WhenResolveUriWithNullUri_ThenThrows()
 {
     Assert.Throws <NullReferenceException>(() => this.service.ResolveUri <IItemContainer>(null));
 }
 public void WhenGettingNameWithNull_ThenExceptionIsThrown()
 {
     Assert.Throws <ArgumentNullException>(() => this.patternModel.GetUniqueName(null));
 }
예제 #16
0
 public void WhenInitializingWithANullExtension_ThenThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => new InstalledToolkitInfo(this.extension, this.reader, this.resource));
 }
예제 #17
0
 public void WhenEnumerableIsNull_ThenThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => EnumerableExtensions.ForEach <string>(null, s => { }));
 }
예제 #18
0
 public void WhenCreatingWithNullSender_ThenThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => Event.Create <EventArgs>(null, EventArgs.Empty));
 }
 public void WhenFindingWithNullManager_ThenThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => PatternManagerExtensions.Find(null, "foo"));
 }
예제 #20
0
 public void WhenCreatingMenuCommandAndCommandIsNull_ThenThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => new VsMenuCommandAdapter(null));
 }
예제 #21
0
 public void WhenFindToolkitOrThrowWithUnknownTemplate_ThenThrows()
 {
     Assert.Throws <InvalidOperationException>(() =>
                                               InstantiationTemplateWizard.FindToolkitOrThrow(this.manager, @"C:\undefined.vstemplate"));
 }
예제 #22
0
            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));
 }
예제 #24
0
 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));
 }
예제 #26
0
 public void WhenGettingOtherContentWithNullContentType_ThenThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => this.target.GetCustomExtensions(null));
 }