Skip to content

Instantly share code, notes, and snippets.

View anton-abyzov's full-sized avatar

Anton Abyzov anton-abyzov

View GitHub Profile
@anton-abyzov
anton-abyzov / EFMaterializationTests.cs
Last active November 10, 2015 12:44
Beware of EF6 (and below) limitations: materialization into domain entity with missing fields
public class EFMaterializationTests
{
/// <summary>
/// Domain entity (WcChallengeDomain in our case) should have all properties mentioned on materialization of EF6 and below. In this case optional field Description is missing
/// on materialization (Select with new WcChallengeDomain) and EF doesn't support it
/// </summary>
[Test]
public void EF6WillThrowExcOnMaterializationOfDomainEntityWithMissingField()
{
//arrange
@anton-abyzov
anton-abyzov / AutoMapperDefaultBehaviourTests.cs
Last active November 10, 2015 14:11
Automapper will ignore lacking or excessed props when doing mapping
/// <summary>
/// Automapper will ignore lacking or excessed props when doing mapping
/// </summary>
public class AutoMapperTests
{
/// <summary>
/// Automapper will ignore outer props of destination entity as it has more props than the source one. Props that are not matched will be
/// populated with default values
/// </summary>
[Test]
package com.example.smartphoneappdevelopguide.objectoriented.postsystem;
import com.example.smartphoneappdevelopguide.objectoriented.postsystem.service.Center;
import com.example.smartphoneappdevelopguide.objectoriented.postsystem.town.Address;
import com.example.smartphoneappdevelopguide.objectoriented.postsystem.town.House;
import com.example.smartphoneappdevelopguide.objectoriented.postsystem.town.HouseMap;
import com.example.smartphoneappdevelopguide.objectoriented.postsystem.user.Customer;
public class Main {
@anton-abyzov
anton-abyzov / 0_reuse_code.js
Created November 12, 2015 14:58
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@anton-abyzov
anton-abyzov / SMTests
Created November 30, 2015 23:03
StructureMap 2.6.4.1 supports lazy initialization
using System;
using NUnit.Framework;
using StructureMap;
namespace StructureMapTests
{
public class SMTests
{
[Test]
public void WillUseLazyInit()
@anton-abyzov
anton-abyzov / StructuremapTests.cs
Created January 24, 2016 10:57
Structuremap registration via IContainer vs ObjectFactory
using Machine.Specifications;
using NUnit.Framework;
using StructureMap;
namespace StructuremapTests
{
// structuremap version 3.1.6.186, Machine Specification 0.9.3, Machine.Specifications.Should 0.8.0
class Program
{
[Test]
<#
.SYNOPSIS
You can use this script to easly transform any XML file using XDT.
To use this script you can just save it locally and execute it. The script
will download it's dependencies automatically.
#>
[cmdletbinding()]
param(
[Parameter(
Mandatory=$true,
- Assume most recent language standard are available (ES6)
- We expect good performance.
- if missing more requirements details, just make reasonable assumptions of
a your own.
- Solution must be simple and compact.
No defensive coding, no comments, no unrequested features.
Only one file 10-20 lines of code
- Work only inside Google Docs: no external editor/IDE/debugger, no copy-paste
to/from such an editor. We must see the flow of how you write the code.