Skip to content

Instantly share code, notes, and snippets.

View marcduiker's full-sized avatar
/-/

Marc Duiker marcduiker

/-/
View GitHub Profile
@marcduiker
marcduiker / Update workflow for all items.ps1
Created May 6, 2016 14:50
Sitecore PowerShell action to update the workflow and workflow state for all items in the ListView of the report.
$processedItems = New-Object System.Collections.ArrayList
function SetWorkFlowAndState {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]
[Sitecore.Data.Items.Item]$Item,
[Parameter(Mandatory=$true)]
[Sitecore.Data.ID]$WorkflowID,
[Parameter(Mandatory=$true)]
@marcduiker
marcduiker / UnitTestWithBulkyArrangeSection.cs
Last active June 2, 2016 21:37
Unit test with bulky assert section. The unit test uses Autofixture, FakeItEasy and FluentAssertions.
[Fact]
public void GetHighestRatedMovies_RepositoryContainsMoviesWithRatings_ReturnsMoviesOrderedByDescendingRating()
{
// Arrange
var fixture = new Fixture();
var movieCollection = fixture.CreateMany<Movie>(20).ToList();
var fakeMovieRepository = A.Fake<IMovieRepository>();
A.CallTo(() => fakeMovieRepository.GetAll()).Returns(movieCollection);
IMovieService movieService = new MovieService(fakeMovieRepository, null, null);
MovieServiceRequest request = new MovieServiceRequest { NumberOfMoviesToReturn = 5 };
@marcduiker
marcduiker / UnitTestWithLeanArrangeSection.cs
Last active March 24, 2017 06:37
Unit test with a lean arrange section. The unit test uses private methods to create the required fake instances using AutoFixture and FakeItEasy. Note that named arguments are used to clarify the meaning of the arguments.
[Fact]
public void GetHighestRatedMovies_RepositoryContainsMoviesWithRatings_ReturnsMoviesOrderedByDescendingRating()
{
// Arrange
IMovieRepository fakeMovieRepository = GetFakeMovieRepository(nrOfMoviesInRepository: 20);
IMovieService movieService = new MovieService(fakeMovieRepository, context: null, logger: null);
MovieServiceRequest request = GetMovieServiceRequest(nrOfMoviesToReturn: 5);
// Act
IList<Movie> movies = movieService.GetHighestRatedMovies(request);
@marcduiker
marcduiker / local_dev_box.txt
Created July 20, 2016 19:46
Boxstarter script for installing dev tools on my local dev machine.
cinst cURL
cinst fiddler4
cinst git
cinst ilspy
cinst luke.portable
cinst mssqlserver2014express
cinst mssqlservermanagementstudio2014express
cinst nodejs.install
cinst notepadplusplus
cinst nuget.commandline
@marcduiker
marcduiker / dev-boxstarter-win10.ps1
Last active October 3, 2022 14:53
This gist can be used to setup a new developer machine with features for IIS/WCF/MSMQ and various dev/ops tools.
# Usage:
# Run the folling command in cmd window or PowerShell with elevated access:
# START http://boxstarter.org/package/nr/url?<link to raw gist>
#
# Prerequisites:
# - Chocolatey
$Boxstarter.RebootOk=$true
$Boxstarter.NoPassword=$false
$Boxstarter.AutoLogin=$true
@marcduiker
marcduiker / NuGet_profile.ps1
Created December 28, 2016 00:13
NuGet PowerShell profile which loads the add-helixmodule.ps1 script
<#
Loads the add-helixmodule.ps1 script to enable the creation of Feature and Foundation project in Sitecore Helix solutions.
You need to change this path to the location where the script is located on your local machine.
Once the script is loaded the Add-Feature and Add-Foundation methods are available in the Package Manager Console in Visual Studio.
#>
. "C:\dev\git\HabitatFork\scripts\add-helixmodule.ps1"
@marcduiker
marcduiker / add-helix-module-configuration.json
Created December 28, 2016 00:29
Configuration file to be used with the add-helixmodule.ps1 script in order to create a new Sitecore module easily.
{
"__comment": "This configuration file is used by the add-helix-module.ps1 script which creates modules for Sitecore Helix solutions.",
"config": {
"__comment__moduleTemplatePath": "Update the moduleTemplatePath property to point to your module-template location.",
"moduleTemplatePath": "C:\\dev\\git\\HabitatFork\\module-template",
"__comment__featureNamespacePrefix": "Replace the value for featureNamespacePrefix with a suitable namespace prefix. The Feature.<ModuleName> will be appended by the script.",
"featureNamespacePrefix": "CompanyNamespace.ClientNamespace",
"__comment__foundationNamespacePrefix": "Replace the value for featureNamespacePrefix with a suitable namespace prefix. The Foundation.<ModuleName> will be appended by the script.",
"foundationNamespacePrefix": "CompanyNamespace",
"__comment__sourceFolderName": "The sourcefolder should contain the relative path (from the sln file folder) where the Feature, Foundation and Project folders are located. The Sitecore Habitat default is
@marcduiker
marcduiker / add-helixmodule.ps1
Last active November 27, 2020 18:11
This script contains the Add-Feature and Add-Foundation methods which can be used to add a new module to a Sitecore Helix based Visual Studio solution.
<#
.SYNOPSIS
This script contains the Add-Feature and Add-Foundation methods which can be used to add a new module to a Sitecore Helix based Visual Studio solution.
The Visual Studio solution should contain a add-helix-module-configuration.json file containing variables which this script will use.
The Add-Feature and Add-Foundation methods can be run from the Pacakge Console Manager as long as this script is loaded in the relevant PowerShell profile.
Run $profile in the Pacakge Manager Console to verify the which profile is used.
#>
@marcduiker
marcduiker / _NamespacePrefix_._ModuleType_._Name_.nuspec
Created January 2, 2017 23:11
Template nuspec file which can be used in Sitecore Helix style solutions when creating a NuGet package per VS project using Octopack.
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>_NamespacePrefix_._ModuleType_._Name_</id>
<title>_NamespacePrefix_._ModuleType_._Name_</title>
<version>$version$</version>
<authors>_Company_</authors>
<owners>_Company_</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>_NamespacePrefix_._ModuleType_._Name_</description>
# DESCRIPTION
# Boxstarter script with limited set of tooling relevant for .Net (web)development.
# This script is used in combination with a Windows 10 Development image obtained
# from https://developer.microsoft.com/en-us/windows/downloads/virtual-machines.
#
# USAGE
# Run the following command in cmd window or PowerShell with elevated access:
# START http://boxstarter.org/package/nr/url?<link to raw gist>
#
# PREREQUISITES