This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestFixture] | |
public class TransportSubscriptionCardPriceCalculatorTests | |
{ | |
private const string GreaterThanZeroExpectionMessage = "The age should be greater than zero."; | |
private const string SmallerThan123ExpectionMessage = "The age should be smaller than 123."; | |
private const string ShouldBeIntegerExpectionMessage = "The age input should be an integer value between 0 - 122."; | |
[Test] | |
public void ValidateCalculateSubscriptionPrice_Free([Random(min: 1, max: 5, count: 1)] | |
int ageInput) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class TransportSubscriptionCardPriceCalculator | |
{ | |
public static decimal CalculateSubscriptionPrice(string ageInput) | |
{ | |
decimal subscriptionPrice = default(decimal); | |
int age = default(int); | |
bool isInteger = int.TryParse(ageInput, out age); | |
if (!isInteger) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var salesMan = GetSalesMan(); | |
// Do database round trip in the following call. | |
var statistics = GetSalesManStatistics(salesMan); | |
// And now we have all our data... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var salesMan = GetSalesMan(); | |
// Do database round trip in the following call. | |
var orderData = GetSalesManOrderData(salesMan); | |
// No more database calls needed. | |
var statistics = GetSalesManStatistics(orderData); | |
// And now we have all our data... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var salesMan = GetSalesMan(); | |
// Do database round trip in the following call. | |
var orderData = GetSalesManOrderData(salesMan); | |
// No more database calls needed. | |
var noOfOrders = GetSalesManNoOfOrder(orderData); | |
var earnings = GetSalesManEarnings(orderData); | |
// etc. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ar salesMan = GetSalesMan(); | |
var noOfOrders = GetSalesManNoOfOrders(salesMan); | |
var customers = GetSalesManCustomers(salesMan); | |
var provision = GetSalesManProvision(salesMan); | |
// etc. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var noOfOrders = GetSalesManNoOfOrders(); | |
var customers = GetSalesManCustomers(); | |
var provision = GetSalesManProvision(); | |
// etc. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static bool IsInt32TryParse(string input) | |
{ | |
int i; | |
return Int32.TryParse(input, out i); | |
} | |
public static bool IsInt32IsDigit(string input) | |
{ | |
foreach (Char c in input) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// output | |
hello | |
world |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setTimeout(function() { | |
console.log("world"); | |
}, 2000) | |
console.log("hello"); |