public void should_throw_exception_on_unknown_feature()
            {
                Assert.ThrowsDelegate action = () =>
                {
                    var config = new ChocolateyConfiguration()
                    {
                        FeatureCommand = new FeatureCommandConfiguration()
                        {
                            Name = "unknown"
                        }
                    };

                    Service.feature_enable(config);
                };

                Assert.Throws <ApplicationException>(action)
                .Message.ShouldEqual("Feature 'unknown' not found");
            }
Esempio n. 2
0
            public void StackTraceForThrowsIsOriginalThrowNotAssertThrows()
            {
                var wasFilterStackTraceAssemblyPrefix = AssertException.FilterStackTraceAssemblyPrefix;

                AssertException.FilterStackTraceAssemblyPrefix = "Should.Core";
                Assert.ThrowsDelegate throwsDelegate = ThrowingMethod;
                try
                {
                    Assert.Throws <InvalidCastException>(throwsDelegate);
                }
                catch (AssertActualExpectedException exception)
                {
                    Assert.Contains(GetMethodFullName(throwsDelegate), exception.StackTrace);
                    Assert.DoesNotContain("Should.Core", exception.StackTrace);
                }
                finally
                {
                    AssertException.FilterStackTraceAssemblyPrefix = wasFilterStackTraceAssemblyPrefix;
                }
            }