Skip to content
Merged
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,5 @@ pip-log.txt
QRCoder/PortabilityAnalysis.html

# Unaccepted approval files
QRCoderTests/*.received.*
*.received.txt
4 changes: 2 additions & 2 deletions QRCoderTests/ArtQRCodeRendererTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ public void should_throw_pixelfactor_oor_exception()
var aCode = new ArtQRCode(data);

var exception = Record.Exception(() => aCode.GetGraphic(10, Color.Black, Color.White, Color.Transparent, pixelSizeFactor: 2));
Assert.NotNull(exception);
Assert.IsType<System.Exception>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<System.Exception>();
exception.Message.ShouldBe("The parameter pixelSize must be between 0 and 1. (0-100%)");
}

Expand Down
84 changes: 42 additions & 42 deletions QRCoderTests/PayloadGeneratorTests/BezahlCodeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@ public void bezahlcode_generator_should_throw_wrong_contact_constructor_exceptio
#pragma warning disable CS0612
var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.singlepayment, name, account, bnc, "", "", "New business contact."));
#pragma warning restore CS0612
Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("The constructor without an amount may only ne used with authority types 'contact' and 'contact_v2'.");
}

Expand All @@ -346,8 +346,8 @@ public void bezahlcode_generator_should_throw_wrong_contact_v2_constructor_excep

var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.periodicsinglepaymentsepa, name, iban: iban, bic: bic));

Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("The constructor without an amount may only ne used with authority types 'contact' and 'contact_v2'.");
}

Expand All @@ -362,8 +362,8 @@ public void bezahlcode_generator_should_throw_wrong_nonsepa_constructor_exceptio

var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.singlepaymentsepa, name, account: account, bnc: bnc, amount: amount));

Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("The constructor with 'account' and 'bnc' may only be used with 'non SEPA' authority types. Either choose another authority type or switch constructor.");
}

Expand All @@ -384,8 +384,8 @@ public void bezahlcode_generator_should_throw_wrong_nonsepa_constructor_periodic
#pragma warning disable CS0612
var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.periodicsinglepayment, name, account, bnc, amount, periodicTimeunit, periodicTimeunitRotation, periodicFirstExecutionDate, periodicLastExecutionDate, reason, postingKey, currency, DateTime.Now));
#pragma warning restore CS0612
Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("When using 'periodicsinglepayment' as authority type, the parameters 'periodicTimeunit' and 'periodicTimeunitRotation' must be set.");
}

Expand All @@ -400,8 +400,8 @@ public void bezahlcode_generator_should_throw_wrong_sepa_constructor_exception()
#pragma warning disable CS0612
var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.singlepayment, name, iban: iban, bic: bic, amount: amount));
#pragma warning restore CS0612
Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("The constructor with 'iban' and 'bic' may only be used with 'SEPA' authority types. Either choose another authority type or switch constructor.");

}
Expand All @@ -423,8 +423,8 @@ public void bezahlcode_generator_should_throw_wrong_sepa_constructor_periodic_ex

var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.periodicsinglepaymentsepa, name, iban, bic, amount, periodicTimeunit, periodicTimeunitRotation, periodicFirstExecutionDate, periodicLastExecutionDate, "", "", new DateTime(2017, 03, 01), reason, sepaReference, currency, DateTime.Now));

Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("When using 'periodicsinglepaymentsepa' as authority type, the parameters 'periodicTimeunit' and 'periodicTimeunitRotation' must be set.");

}
Expand All @@ -440,8 +440,8 @@ public void bezahlcode_generator_should_throw_name_too_long_exception()

var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.singlepaymentsepa, name, iban: iban, bic: bic, amount: amount));

Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("(Payee-)Name must be shorter than 71 chars.");

}
Expand All @@ -458,8 +458,8 @@ public void bezahlcode_generator_should_throw_reason_too_long_exception()

var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.singlepaymentsepa, name, iban: iban, bic: bic, amount: amount, reason: reason));

Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("Reasons texts have to be shorter than 141 chars.");

}
Expand All @@ -475,8 +475,8 @@ public void bezahlcode_generator_should_throw_invalid_account_exception()
#pragma warning disable CS0612
var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.singlepayment, name, account: account, bnc: bnc, amount: amount));
#pragma warning restore CS0612
Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("The account entered isn't valid.");
}

Expand All @@ -491,8 +491,8 @@ public void bezahlcode_generator_should_throw_invalid_bnc_exception()
#pragma warning disable CS0612
var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.singlepayment, name, account: account, bnc: bnc, amount: amount));
#pragma warning restore CS0612
Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("The bnc entered isn't valid.");
}

Expand All @@ -508,8 +508,8 @@ public void bezahlcode_generator_should_throw_invalid_postingkey_exception()
#pragma warning disable CS0612
var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.singlepayment, name, account: account, bnc: bnc, amount: amount, postingKey: postingKey));
#pragma warning restore CS0612
Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("PostingKey must be within 0 and 99.");
}

Expand All @@ -524,8 +524,8 @@ public void bezahlcode_generator_should_throw_invalid_iban_exception()

var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.singlepaymentsepa, name, iban: iban, bic: bic, amount: amount));

Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("The IBAN entered isn't valid.");

}
Expand All @@ -541,8 +541,8 @@ public void bezahlcode_generator_should_throw_invalid_bic_exception()

var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.singlepaymentsepa, name, iban: iban, bic: bic, amount: amount));

Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("The BIC entered isn't valid.");

}
Expand All @@ -563,8 +563,8 @@ public void bezahlcode_generator_should_throw_separeference_too_long_exception()

var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.singledirectdebitsepa, name, iban, bic, amount, "", 0, null, null, creditorId, mandateId, new DateTime(2017, 03, 01), reason, sepaReference, currency, DateTime.Now));

Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("SEPA reference texts have to be shorter than 36 chars.");

}
Expand All @@ -585,8 +585,8 @@ public void bezahlcode_generator_should_throw_invalid_creditorid_exception()

var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.singledirectdebitsepa, name, iban, bic, amount, "", 0, null, null, creditorId, mandateId, new DateTime(2017, 03, 01), reason, sepaReference, currency, DateTime.Now));

Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("The creditorId entered isn't valid.");
}

Expand All @@ -606,8 +606,8 @@ public void bezahlcode_generator_should_throw_invalid_mandateid_exception()

var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.singledirectdebitsepa, name, iban, bic, amount, "", 0, null, null, creditorId, mandateId, new DateTime(2017, 03, 01), reason, sepaReference, currency, DateTime.Now));

Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("The mandateId entered isn't valid.");
}

Expand All @@ -621,8 +621,8 @@ public void bezahlcode_generator_should_throw_amount_too_much_digits_exception()

var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.singlepaymentsepa, name, iban: iban, bic: bic, amount: amount));

Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("Amount must have less than 3 digits after decimal point.");

}
Expand All @@ -638,8 +638,8 @@ public void bezahlcode_generator_should_throw_amount_too_big_exception()

var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.singlepaymentsepa, name, iban: iban, bic: bic, amount: amount));

Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("Amount has to at least 0.01 and must be smaller or equal to 999999999.99.");

}
Expand All @@ -659,8 +659,8 @@ public void bezahlcode_generator_should_throw_invalid_executiondate_exception()
#pragma warning disable CS0612
var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.singlepayment, name, account, bnc, amount, "", 0, null, null, reason, postingKey, currency, executionDate));
#pragma warning restore CS0612
Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("Execution date must be today or in future.");
}

Expand All @@ -682,8 +682,8 @@ public void bezahlcode_generator_should_throw_invalid_periodictimeunit_exception

var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.periodicsinglepaymentsepa, name, iban, bic, amount, periodicTimeunit, periodicTimeunitRotation, periodicFirstExecutionDate, periodicLastExecutionDate, "", "", new DateTime(2017, 03, 01), reason, sepaReference, currency, DateTime.Now));

Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("The periodicTimeunit must be either 'M' (monthly) or 'W' (weekly).");
}

Expand All @@ -705,8 +705,8 @@ public void bezahlcode_generator_should_throw_invalid_periodictimeunitrotation_e

var exception = Record.Exception(() => new PayloadGenerator.BezahlCode(AuthorityType.periodicsinglepaymentsepa, name, iban, bic, amount, periodicTimeunit, periodicTimeunitRotation, periodicFirstExecutionDate, periodicLastExecutionDate, "", "", new DateTime(2017, 03, 01), reason, sepaReference, currency, DateTime.Now));

Assert.NotNull(exception);
Assert.IsType<BezahlCodeException>(exception);
exception.ShouldNotBeNull();
exception.ShouldBeOfType<BezahlCodeException>();
exception.Message.ShouldBe("The periodicTimeunitRotation must be 1 or greater. (It means repeat the payment every 'periodicTimeunitRotation' weeks/months.");
}
}
Loading
Loading