This file contains 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
private static void OutputNoDefault(SqlCommand cmd) | |
{ | |
cmd.CommandType = CommandType.StoredProcedure; | |
cmd.CommandText = "usp_Output_No_Default"; | |
SqlParameter par = new SqlParameter("@param1", SqlDbType.VarChar); | |
par.Direction = ParameterDirection.Output; | |
par.Size = 50; | |
par.Value = null; | |
cmd.Parameters.Add(par); |
This file contains 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
CREATE PROCEDURE [dbo].[usp_Output_No_Default] | |
@param1 VARCHAR(50) OUTPUT | |
AS | |
SELECT @param1; | |
SET @param1 = 'changed by procedure'; | |
RETURN 0 |
This file contains 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
using Moq; | |
using Service; | |
using System; | |
namespace Business.Tests | |
{ | |
public static class StockServiceMocks | |
{ | |
/// <summary> | |
/// Causes GetCurrentPrice to return a specific price or optionally throws an exception. |
This file contains 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
namespace Service | |
{ | |
public interface IStockService | |
{ | |
Trade Buy(string ticker, decimal nbrShares); | |
decimal GetCurrentPrice(string ticker); | |
Trade GetLastTrade(string ticker); | |
Trade Sell(string ticker, decimal nbrShares); | |
} | |
} |
This file contains 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
namespace Service | |
{ | |
public interface ILogService | |
{ | |
void Log(string logMessage); | |
} | |
} |
This file contains 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
using Service; | |
using System; | |
namespace Business | |
{ | |
public class StocksLogic | |
{ | |
private readonly IStockService _stockService; | |
private readonly ILogService _logService; |
This file contains 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
[TestMethod] | |
public void BuyWhenLastTradeWasSell_Test() | |
{ | |
#region setup the stock service | |
decimal simulatedCurrentPrice = 8.03m; | |
Trade simulatedLastTrade = new Trade | |
{ | |
Ticker = "ABC", | |
Side = "sell", |
This file contains 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
<!doctype html> | |
<html> | |
<head> | |
<!-- stuff... --> | |
</head> | |
<body> | |
<div id="gameDiv"></div> | |
<script src="https://newupwaititsfun.z13.web.core.windows.net/frog/game.js" integrity="sha384-qoRzVFhcu3MPqU4+hUIAG45mJWAXYwf1QDlkHQY2519KjBjFyETk7mTDV/wY9AD1" | |
crossorigin="anonymous"></script> | |
</body> |
This file contains 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
using Microsoft.Win32.SafeHandles; | |
using System; | |
using System.IO; | |
using System.Runtime.InteropServices; | |
namespace AlternateDataStreams | |
{ | |
class Program | |
{ | |
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] |
This file contains 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
using System; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
namespace CosmosCreateSproc | |
{ | |
class Program | |
{ | |
static async Task Main(string[] args) | |
{ |