Skip to content

Instantly share code, notes, and snippets.

View takahirohonda's full-sized avatar

Takahiro Honda takahirohonda

View GitHub Profile
@takahirohonda
takahirohonda / FrontEndTestControllerTest.cs
Created August 18, 2019 13:35
FrontEndTestControllerTest.cs
using FluentAssertions;
using NSubstitute;
using Sitecore.Mvc.Presentation;
using SitecoreDev.Feature.Design.Controllers;
using SitecoreDev.Feature.Design.Models;
using SitecoreDev.Feature.Design.Repository;
using System;
using System.Collections.Generic;
using System.Web.Mvc;
using Xunit;
@takahirohonda
takahirohonda / FrontEndTestRepositoryTest.cs
Created August 18, 2019 13:34
FrontEndTestRepositoryTest.cs
using FluentAssertions;
using Sitecore.Data;
using Sitecore.FakeDb;
using SitecoreDev.Feature.Design.Models;
using SitecoreDev.Feature.Design.Repository;
using Xunit;
namespace SitecoreDev.Feature.Design.Tests.RepositoryTests
{
public class FrontEndTestRepositoryTests
@takahirohonda
takahirohonda / how-to-troubleshoot-fakedb-errors-sitecore-8-2.config
Created August 17, 2019 13:43
how-to-troubleshoot-fakedb-errors-sitecore-8-2.config
<sitecore>
<settings>
<setting name="LicenseFile" value="..\..\..\libs\license.xml" />
</settings>
</sitecore>
@takahirohonda
takahirohonda / Sitecore.FakeDb.config
Created August 17, 2019 13:14
Sitecore.FakeDb.config
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<databases>
<database id="core">
<patch:attribute name="type">Sitecore.Data.DefaultDatabase, Sitecore.Kernel</patch:attribute>
</database>
<database id="master">
<patch:attribute name="type">Sitecore.Data.DefaultDatabase, Sitecore.Kernel</patch:attribute>
</database>
@takahirohonda
takahirohonda / how-to-mock-rendering-parameters-in-unit-test-sitecore-2.cs
Created August 17, 2019 04:37
how-to-mock-rendering-parameters-in-unit-test-sitecore-2.cs
using FluentAssertions;
using Sitecore.Mvc.Presentation;
using SitecoreDev.Feature.Design.Models;
using SitecoreDev.Feature.Design.Repository;
using System.Collections.Generic;
using Xunit;
namespace SitecoreDev.Feature.Design.Tests.RepositoryTests
{
public class CustomDataDivRepositoryTests
@takahirohonda
takahirohonda / how-to-mock-rendering-parameters-in-unit-test-sitecore-1.cs
Last active August 17, 2019 15:57
how-to-mock-rendering-parameters-in-unit-test-sitecore-1.cs
using FluentAssertions;
using NSubstitute;
using Sitecore.Mvc.Presentation;
using SitecoreDev.Feature.Design.Controllers;
using SitecoreDev.Feature.Design.Models;
using SitecoreDev.Feature.Design.Repository;
using System;
using System.Collections.Generic;
using System.Web.Mvc;
using Xunit;
@takahirohonda
takahirohonda / using-rendering-parameters-to-inject-data-into-hidden-input-sitecore-0.html
Created August 16, 2019 15:12
using-rendering-parameters-to-inject-data-into-hidden-input-sitecore-0.html
<input
hidden
custom-data={
"purpose":"form-render",
"cssClass": "btn-danger",
"startIndex": "0",
"existing": "true"
}
id="custom-data"
/>
@takahirohonda
takahirohonda / using-rendering-parameters-to-inject-data-into-hidden-input-sitecore-4.cs
Created August 16, 2019 15:08
using-rendering-parameters-to-inject-data-into-hidden-input-sitecore-4.cs
using Sitecore.Mvc.Presentation;
using SitecoreDev.Feature.Design.Models;
using System.Collections.Generic;
namespace SitecoreDev.Feature.Design.Repository
{
public class CustomDataDivRepository : ICustomDataDivRepository
{
private readonly CustomDataDiv model;
@takahirohonda
takahirohonda / using-rendering-parameters-to-inject-data-into-hidden-input-sitecore-3.cs
Last active August 17, 2019 04:35
using-rendering-parameters-to-inject-data-into-hidden-input-sitecore-3.cs
using SitecoreDev.Feature.Design.Repository;
using Sitecore.Mvc.Presentation;
using Sitecore.Mvc.Controllers;
using System.Web.Mvc;
namespace SitecoreDev.Feature.Design.Controllers
{
public class CustomDataDivController : SitecoreController
{
private readonly ICustomDataDivRepository customDataDivRrepository;
@takahirohonda
takahirohonda / using-rendering-parameters-to-inject-data-into-hidden-input-sitecore-2.cshtml
Created August 16, 2019 15:06
using-rendering-parameters-to-inject-data-into-hidden-input-sitecore-2.cshtml
@model SitecoreDev.Feature.Design.Models.CustomDataDiv
@using System.Web.Script.Serialization;
@if (Model != null)
{
var json = new JavaScriptSerializer().Serialize(Model.CustomData);
<input hidden [email protected](@json) id="custom-data" />
}