private TransactionEntity CreateTransaction(AccountType fromAccountType, AccountType toAccountType) { var fromCustomizer = new FixedConstructorParameter <AccountEntity>(CreateAccount(fromAccountType), "fromAccount"); var toCustomizer = new FixedConstructorParameter <AccountEntity>(CreateAccount(toAccountType), "toAccount"); return(Create <Peent.Domain.Entities.TransactionAggregate.Transaction>(fromCustomizer, toCustomizer)); }
private AccountEntity CreateAccount(AccountType type) { var customizer = new FixedConstructorParameter <AccountType>( type, nameof(Peent.Domain.Entities.Account.Type).FirstDown()); return(Create <AccountEntity>(customizer)); }
public void when_amount_is_not_zero__does_not_throw(decimal amount) { var customizer = new FixedConstructorParameter <decimal>( amount, nameof(Money.Amount).FirstDown()); var money = Create <Money>(customizer); money.Amount.Should().Be(amount); }
public void when_type_is_not_of_unknown_type__does_not_throw(AccountType type) { var customizer = new FixedConstructorParameter <AccountType>( type, nameof(Sut.Type).FirstDown()); var account = Create <Sut>(customizer); account.Type.Should().Be(type); }
public void when_tag_is_not_null__does_not_throw() { var tag = F.Create <Peent.Domain.Entities.Tag>(); var customizer = new FixedConstructorParameter <Peent.Domain.Entities.Tag>( tag, nameof(Sut.Tag).FirstDown()); var transactionTag = Create <Sut>(customizer); transactionTag.Tag.Should().Be(tag); }
public void when_symbol_is_not_null_or_white_space__does_not_throw() { var symbol = F.Create <string>(); var customizer = new FixedConstructorParameter <string>( symbol, nameof(Sut.Symbol).FirstDown()); var account = Create <Sut>(customizer); account.Symbol.Should().Be(symbol); }
public void when_currency_is_null__throws_argument_exception() { var parameterName = nameof(Money.Currency).FirstDown(); var customizer = new FixedConstructorParameter <Currency>(null, parameterName); Action act = () => Create <Money>(customizer); act.Should().Throw <ArgumentException>() .WithMessage($"*{parameterName}*"); }
public void when_currency_is_not_null__does_not_throw() { var currency = F.Create <Peent.Domain.Entities.Currency>(); var customizer = new FixedConstructorParameter <Peent.Domain.Entities.Currency>( currency, nameof(Sut.Currency).FirstDown()); var account = Create <Sut>(customizer); account.Currency.Should().Be(currency); }
public void when_name_is_not_null_or_white_space__does_not_throw() { var name = F.Create <string>(); var customizer = new FixedConstructorParameter <string>( name, nameof(Sut.Name).FirstDown()); var account = Create <Sut>(customizer); account.Name.Should().Be(name); }
public void when_money_is_not_null__does_not_throw() { var money = F.Create <Money>(); var customizer = new FixedConstructorParameter <Money>( money, nameof(Sut.Money).FirstDown()); var transactionEntry = Create <Sut>(customizer); transactionEntry.Money.Should().Be(money); }
public void when_decimal_places_id_is_positive__does_not_throw() { var decimalPlaces = F.Create <ushort>(); var customizer = new FixedConstructorParameter <ushort>( decimalPlaces, nameof(Sut.DecimalPlaces).FirstDown()); var account = Create <Sut>(customizer); account.DecimalPlaces.Should().Be(decimalPlaces); }
public void when_currency_is_not_null__does_not_throw() { var currency = F.Create <Currency>(); var customizer = new FixedConstructorParameter <Currency>( currency, nameof(Money.Currency).FirstDown()); var account = Create <Money>(customizer); account.Currency.Should().Be(currency); }
public void when_account_is_not_null__does_not_throw() { var account = F.Create <Peent.Domain.Entities.Account>(); var customizer = new FixedConstructorParameter <Peent.Domain.Entities.Account>( account, nameof(Sut.Account).FirstDown()); var transactionEntry = Create <Sut>(customizer); transactionEntry.Account.Should().Be(account); }
public void when_symbol_is_null_or_white_space__throws_argument_exception(string symbol) { var parameterName = nameof(Sut.Symbol).FirstDown(); var customizer = new FixedConstructorParameter <string>( symbol, parameterName); Action act = () => Create <Sut>(customizer); act.Should().Throw <ArgumentException>() .WithMessage($"*{parameterName}*"); }
public void when_decimal_places_is_not_positive__throws_argument_exception(ushort decimalPlaces) { var parameterName = nameof(Sut.DecimalPlaces).FirstDown(); var customizer = new FixedConstructorParameter <ushort>( decimalPlaces, parameterName); Action act = () => Create <Sut>(customizer); act.Should().Throw <ArgumentException>() .WithMessage($"*{parameterName}*"); }
public void when_amount_is_zero__throws_argument_exception() { var parameterName = nameof(Money.Amount).FirstDown(); var customizer = new FixedConstructorParameter <decimal>( 0, parameterName); Action act = () => Create <Money>(customizer); act.Should().Throw <ArgumentException>() .WithMessage($"*{parameterName}*"); }
public void when_type_is_of_unknown_type__throws_argument_exception() { var parameterName = nameof(Sut.Type).FirstDown(); var customizer = new FixedConstructorParameter <AccountType>( AccountType.Unknown, parameterName); Action act = () => Create <Sut>(customizer); act.Should().Throw <ArgumentException>() .WithMessage($"*{parameterName}*"); }
public void when_tag_is_null__throws_argument_exception() { var parameterName = nameof(Sut.Tag).FirstDown(); var customizer = new FixedConstructorParameter <Peent.Domain.Entities.Tag>( null, parameterName); Action act = () => Create <Sut>(customizer); act.Should().Throw <ArgumentException>() .WithMessage($"*{parameterName}*"); }
public void when_category_is_null__throws_argument_exception() { var parameterName = nameof(Sut.Category).FirstDown(); var customizer = new FixedConstructorParameter <CategoryEntity>(null, parameterName); _fixture.Customizations.Add(customizer); Action act = () => Create <Sut>(_fixture); act.Should().Throw <ArgumentException>() .WithMessage($"*{parameterName}*"); }
public void when_category_is_not_null__does_not_throw() { var category = _fixture.Create <CategoryEntity>(); var customizer = new FixedConstructorParameter <CategoryEntity>( category, nameof(Sut.Category).FirstDown()); _fixture.Customizations.Add(customizer); var account = Create <Sut>(_fixture); account.Category.Should().Be(category); }
public void when_title_is_not_null_or_white_space__does_not_throw() { var title = _fixture.Create <string>(); var customizer = new FixedConstructorParameter <string>( title, nameof(Sut.Title).FirstDown()); _fixture.Customizations.Add(customizer); var transaction = Create <Sut>(_fixture); transaction.Title.Should().Be(title); }
public void when_title_is_null_or_white_space__throws_argument_exception(string title) { var parameterName = nameof(Sut.Title).FirstDown(); var customizer = new FixedConstructorParameter <string>( title, parameterName); _fixture.Customizations.Add(customizer); Action act = () => Create <Sut>(_fixture); act.Should().Throw <ArgumentException>() .WithMessage($"*{parameterName}*"); }
public void when_to_account_is_null__throws_argument_exception() { var parameterName = "to" + nameof(Peent.Domain.Entities.Account); AccountEntity account = null; var customizer = new FixedConstructorParameter <AccountEntity>( account, parameterName); _fixture.Customizations.Insert(1, customizer); Action act = () => Create <Sut>(_fixture); act.Should().Throw <ArgumentException>() .WithMessage($"*{parameterName}*"); }
public void when_description_is_null_or_white_space__does_not_throw(string description) { var parameterName = nameof(Sut.Description).FirstDown(); var customizer = new FixedConstructorParameter <string>( description, parameterName); var fixture = Fixture(customizer); fixture.Customize <Sut>(c => c.FromFactory(new MethodInvoker(new GreedyConstructorQuery()))); var account = fixture.Create <Sut>(); account.Description.Should().Be(description); }