public void ConstructorTimingNull()
 {
     Assert.That(() => new AdaptiveTiming(null), Throws.TypeOf <ArgumentNullException>());
 }
Example #2
0
 public void TestInstantiateWithInvalidDecoder()
 {
     Assert.That(() => new Mpg123("foobar"), Throws.TypeOf <Mpg123.ErrorException>());
 }
Example #3
0
        public void Should_not_be_handled_on_initial()
        {
            var instance = new Instance();

            Assert.That(async() => await _machine.RaiseEvent(instance, x => x.Hello), Throws.TypeOf <UnhandledEventException>());

            Assert.IsFalse(instance.HelloCalled);
            Assert.AreEqual(_machine.Initial, instance.CurrentState);
        }
        public void WhenCreateWithNullHbmJoinThenThrows()
        {
            var mapdoc = new HbmMapping();

            Assert.That(() => new JoinMapper(typeof(MyClass), "AA", null, mapdoc), Throws.TypeOf <ArgumentNullException>());
        }
Example #5
0
 public void Should_receive_the_exception()
 {
     Assert.That(async() => await _requestClient.GetResponse <PongMessage>(new PingMessage()), Throws.TypeOf <RequestFaultException>());
 }
        public void WithoutMissingMembers()
        {
            DocumentBuilder builder = new DocumentBuilder();

            //Add templete to the document for reporting engine
            DocumentHelper.InsertBuilderText(builder, new[] { "<<[missingObject.First().id]>>", "<<foreach [in missingObject]>><<[id]>><</foreach>>" });

            //Assert that build report failed without "ReportBuildOptions.AllowMissingMembers"
            Assert.That(() => BuildReport(builder.Document, new DataSet(), "", ReportBuildOptions.None), Throws.TypeOf <InvalidOperationException>());
        }
 public void ThrowArgumentException_WhenIncorrectArgs(int precision, int scale, bool onlyPositive)
 {
     Assert.That(() => new NumberValidator(precision, scale, onlyPositive),
                 Throws.TypeOf <ArgumentException>());
 }
 public void CreateSiteOnDb_TooLong_name_Throws()
 {
     Assert.That(() => siteFactory.CreateSiteOnDb(connectionString, "MP6rVLwFsoy1WYITJjrY1oETEy3kvLRkMCAAZvikN47O8h6ak8dYSS1eh9a2SOslqeXbOW6ry63oqwyUu8N4MmjYY7FHO5aJ9OjwvTosg9Tdc5Xxlu1gpmM13lME1wUTm", 1, 600, 0.01),
                 Throws.TypeOf <ArgumentException>());
 }
 public void GetTheTimezoneOf_TooShort_name_Throws()
 {
     Assert.That(() => siteFactory.GetTheTimezoneOf(connectionString, ""), Throws.TypeOf <ArgumentException>());
 }
 public void CreateSiteOnDb_ZeroSessionExpirationTime_Throws()
 {
     Assert.That(() => siteFactory.CreateSiteOnDb(connectionString, "troppo giusto", 1, 0, 0.01),
                 Throws.TypeOf <ArgumentOutOfRangeException>());
 }
 public void CreateSiteOnDb_TooShort_name_Throws()
 {
     Assert.That(() => siteFactory.CreateSiteOnDb(connectionString, "", 1, 600, 0.01),
                 Throws.TypeOf <ArgumentException>());
 }
 public void CreateSiteOnDb_ZeroMinimumBidIncrement_Throws()
 {
     Assert.That(() => siteFactory.CreateSiteOnDb(connectionString, "troppo giusto", 1, 600, 0),
                 Throws.TypeOf <ArgumentOutOfRangeException>());
 }
 public void LoadSite_TooShort_name_Throws()
 {
     Assert.That(() => siteFactory.LoadSite(connectionString, "", _alarmClockMock.Object),
                 Throws.TypeOf <ArgumentException>());
 }
        public static void AddWithNull()
        {
            var style = new CSharpSpaceBetweenMethodDeclarationParameterListParenthesesStyle(new BooleanData());

            Assert.That(() => style.Add(null !), Throws.TypeOf <ArgumentNullException>());
        }
Example #15
0
 public void Division(int num1, int num2, int resultado)
 {
     Assert.AreEqual(resultado, iCalculadora.Division(num1, num2));
     Throws.TypeOf <DivideByZeroException>();
 }
Example #16
0
        public static void GetId_with_bad_name_Throws()
        {
            var realTool = MakeRealTool();

            Assert.That(() => realTool.GetId("ABC123"), Throws.TypeOf <KeyNotFoundException>());
        }
Example #17
0
 public void DivisionByZero(int num1, int num2)
 {
     Assert.That(() => iCalculadora.Division(num1, num2), Throws.TypeOf <DivideByZeroException>());
 }
Example #18
0
 public void CopyById_throws()
 {
     Assert.That(() => _fakeTool.Copy(1, "new"), Throws.TypeOf <NotImplementedException>());
 }
Example #19
0
 public void Rectangle_Parse_FailsForInvalidStrings()
 {
     Assert.That(() => Rectangle.Parse("foo"),
                 Throws.TypeOf <FormatException>());
 }
Example #20
0
 public void Create_throws(
     [Values(null, "", " ")] string input)
 {
     Assert.That(() => _fakeTool.Create(input), Throws.TypeOf <ArgumentException>());
 }
Example #21
0
        public void WhenCreateWithEmptySplitGroupThenThrows()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();

            Assert.That(() => new JoinMapper(typeof(MyClass), null, hbmJoin, mapdoc), Throws.TypeOf <ArgumentNullException>());
            Assert.That(() => new JoinMapper(typeof(MyClass), "", hbmJoin, mapdoc), Throws.TypeOf <ArgumentOutOfRangeException>());
            Assert.That(() => new JoinMapper(typeof(MyClass), "     ", hbmJoin, mapdoc), Throws.TypeOf <ArgumentOutOfRangeException>());
        }
Example #22
0
 public void Get_by_id_throws(
     )
 {
     Assert.That(() => _fakeTool.Get(Guid.Empty), Throws.TypeOf <ArgumentException>());
 }
Example #23
0
 public void Should_timeout()
 {
     Assert.That(async() => await _requestClient.GetResponse <PongMessage>(new PingMessage()), Throws.TypeOf <RequestTimeoutException>());
 }
Example #24
0
 public void Get_by_name_throws(
     [Values(null, "", " ")] string name
     )
 {
     Assert.That(() => _fakeTool.Get(name), Throws.TypeOf <ArgumentException>());
 }
Example #25
0
 public void Throws_on_invalid_arguments()
 {
     Assert.That(
         () => Task.Run(() => ((TestInMemoryDatabase)Database).Database.RemoveAllCommandAsync(" ")).Wait(),
         Throws.TypeOf <AggregateException>().With.InnerException.TypeOf <ArgumentNullException>());
 }
 public void ReadEmailGroupFromXmlUsingInvalidNotificationType()
 {
     Assert.That(delegate { NetReflector.Read(@"<group> name=""foo"" <notifications><NotificationType>bar</NotificationType></notifications>  </group>"); },
                 Throws.TypeOf <NetReflectorException>());
 }
 public static void Ctor_GivenNegativeColumnOrder_ThrowsArgumentOutOfRangeException()
 {
     Assert.That(() => new ColumnOrderAttribute(-1), Throws.TypeOf <ArgumentOutOfRangeException>());
 }
 public void ProcessResponseThrowsAnExceptionForUnknownMessage()
 {
     Assert.That(delegate { XmlConversionUtil.ProcessResponse("<garbage/>"); },
                 Throws.TypeOf <CommunicationsException>());
 }
Example #29
0
 public void MissingDirectoryThrowsException()
 {
     Assert.IsFalse(tempRoot.Exists(), "Temporary directory should not exist: " + tempRoot.ToString());
     Assert.That(delegate { sc.GetModifications(IntegrationResult(DateTime.MinValue), IntegrationResult(DateTime.MaxValue)); },
                 Throws.TypeOf <DirectoryNotFoundException>());
 }
Example #30
0
 public void CreateWithIllegalMinimumIterationsThrowsArgumentOutOfRangeException()
 {
     Assert.That(() => new DivergenceStopCriterion <double>(minimumIterations: 2), Throws.TypeOf <ArgumentOutOfRangeException>());
 }