Skip to content

Instantly share code, notes, and snippets.

@bpatra
bpatra / Add-Migration.ps1
Created December 5, 2020 22:32
Add-Migration
Add-Migration MigrationE -ConnectionString "<yourConnectionString>" -ConnectionProviderName "System.Data.SqlClient" -Verbose
Update-Database MigrationD -ConnectionString "<yourConnectionString>" -ConnectionProviderName "System.Data.SqlClient" -Verbose
Database.SetInitializer(new MigrateDatabaseToLatestVersion<MyDbContext, Configuration>());
public abstract class AdminViewModelWithThreeExistingMatters : GeneralAdminViewModelTests
{
public const string FirstMatter = "QSG vs Rapid Vienna";
public const string SecondMatter = "FCN vs Juventus";
public const string ThirdMatter = "Bordeaux vs Milan";
protected Guid SecondMatterId;
protected Guid FirstMatterId;
protected override void SetupMocks()
{
public abstract class GeneralAdminViewModelTests : Specification
{
protected AdminViewModel AdminViewModel;
protected Mock BusinessObjectFactory = new Mock();
protected Mock IIoservice = new Mock ();
protected Mock SettingsProvider = new Mock();
protected Mock SubVmFactory = new Mock();
protected Mock FileNameGeneratorViewModel = new Mock ();
protected Mock SummaryViewModel = new Mock();
public abstract class Specification
{
protected Specification()
{
Extablished_Context();
Because_Of();
}
public abstract void Because_Of();
//this javascript lives in the sandboxed environment
//urlNavigate is the oauth2.0 url of the apis you are targeting with the parameters
//use callback.html as redirect uri.
var childWindow =window.open(urlNavigate,'Auth window', 'height=500,width=500');
var interval;
var pollChildWindow = function () {
if (childWindow.closed === false) {
var oauthHash;
try {
//this throws exception until the popup returns to
<!--usual html5 doctype and meta-->
<body>
<div id="oauthurl"></div>
<script>
var closeWindowCheck = function () {
<!--transmit the hash of the return url to the parent iframe-->
window.oauthHash = location.hash;
<!-- wait that the parent window give its approbation to close-->
if (window.canclosewindow === true) {
class DesignSummaryTabViewModel : ISummaryTabViewModel
{
public string Name { get { return "Raymond Domenech"; } }
public int Age { get { return 62; } }
}
public class DesignMainViewModel : IMainViewModel
{
public static IPerson fakePerson = new Person()
{
Name = "Raymond Domenech",
Age = 62,
Books = new IBook[0]
};
public static IPerson fakePerson2 = new Person()