Wednesday, November 20, 2013
Simple Membership + WebMatrix.Data & WebMatrix.WebData
In order to use simple membership roles with an MVC5 project you need WebMatrix.WebData reference. To obtain this Reference you need to use nuget and install Microsoft.AspNet.WebHelpers. I am documenting it here so i don't forget.
Non-MVC projects need Microsoft.AspNet.WebPages.OAuth (Install-Package Microsoft.AspNet.WebPages.OAuth)
http://stackoverflow.com/questions/13324544/how-to-add-asp-net-membership-provider-in-a-empty-mvc-4-project-template/13325883#13325883
Sunday, November 17, 2013
Visual Studio 2013 + Angularjs + JasmineJS + Resharper 7/8 (or Chutzpah)
I recently started a project which used the following technologies: Visual Studio 2013 + Angularjs + JasmineJS + Resharper 7/8 (or Chutzpah).
I was having a rough time getting JasmineJS to work with Resharper/Chutzpah. The strange thing was that it would work in the specrunner but not in the actual resharper or chutzpah interfaces which directly integrate into Visual Studio (which is what i wanted).
After spending a couple hours of research i came upon this blog: http://microsoftwindowsblogger.blogspot.com/2013/10/best-unit-testing-angularjs-with.html
Basically you have to inject the script references into the unit test files (which i knew) but they must ALSO BE RELATIVE PATHS TO THE TEST FILE!
Here is an example of a working Jasmine Unit Test which integrates angularjs and works with both Chutzpah and Resharper 7+:
I was having a rough time getting JasmineJS to work with Resharper/Chutzpah. The strange thing was that it would work in the specrunner but not in the actual resharper or chutzpah interfaces which directly integrate into Visual Studio (which is what i wanted).
After spending a couple hours of research i came upon this blog: http://microsoftwindowsblogger.blogspot.com/2013/10/best-unit-testing-angularjs-with.html
Basically you have to inject the script references into the unit test files (which i knew) but they must ALSO BE RELATIVE PATHS TO THE TEST FILE!
Here is an example of a working Jasmine Unit Test which integrates angularjs and works with both Chutzpah and Resharper 7+:
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
/// <reference path="../../Scripts/jasmine/jasmine.js" /> | |
/// <reference path="../../Scripts/angular.js" /> | |
/// <reference path="../../Scripts/angular-mocks.js" /> | |
/// <reference path="../../Scripts/angular-resource.js" /> | |
/// <reference path="../../Scripts/angular-route.js" /> | |
/// <reference path="../../Scripts/ui-bootstrap-tpls-0.6.0.js" /> | |
/// <reference path="../app.js" /> | |
/// <reference path="../DataEntry/DataEntryCtrl.js" /> | |
describe("DataEntryCtrl", function () { | |
var $scope = null; | |
var $controller = null; | |
var $httpBackend = null; | |
beforeEach(function () { | |
module("app"); | |
}); | |
beforeEach(function () {// we need to use toEqualData because the Resource has extra properties | |
// which make simple .toEqual not work. | |
this.addMatchers({ | |
toEqualData: function (expect) { | |
return angular.equals(expect, this.actual); | |
} | |
}); | |
}); | |
//you need to indicate your module in a test | |
// read: http://docs.angularjs.org/api/ngMock.$httpBackend | |
beforeEach(inject(function ($rootScope, _$controller_, _$httpBackend_) { | |
$scope = $rootScope.$new(); | |
$controller = _$controller_; | |
$httpBackend = _$httpBackend_; | |
// Fake all my services | |
//$httpBackend.whenGET("api/location").respond([]); | |
//$httpBackend.whenGET("api/tuitionType").respond([]); | |
//$httpBackend.whenGET("api/cohort").respond([]); | |
//$httpBackend.whenGET("api/course").respond([]); | |
var ctrl = $controller('DataEntryCtrl', { $scope: $scope }); | |
})); | |
// Actual Unit Tests | |
// Naming: Method_Scenario_ExpectedBehavior | |
it("oneEqualsOne_ReturnTrue", function () { | |
expect(1).toEqual(1); | |
}); | |
}); |
Subscribe to:
Posts (Atom)
-
While working on a project I was using a MsSQL 2012 database for my persistence layer but wanted to use a SQLITE in memory database for my u...
-
Redmine Install Process -- Download and install turnkey linux's redmine appliance http://www.turnkeylinux.org/redmine -- install up...
-
I recently installed windows 10 preview on an old laptop (Dell Precision) which has an Nvidia Quadro 3000M video card. After running window...