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
_fixture.Register<Animal>(() => null); |
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
_fixture.Customizations.Add( | |
new TypeRelay( | |
typeof(Animal), | |
typeof(Dog))); | |
_fixture.Customizations.Add( | |
new TypeRelay( | |
typeof(Animal), | |
typeof(Cat))); |
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
public class Person { | |
List<Person> Friends { get; set;} | |
} |
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
//This code is needed to support recursion | |
_fixture.Behaviors.OfType<ThrowingRecursionBehavior>().ToList() | |
.ForEach(b => _fixture.Behaviors.Remove(b)); | |
_fixture.Behaviors.Add(new OmitOnRecursionBehavior(1)); |
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
var parents = await _context.Set<Parent>() | |
.Include(m => (m as Child1).Property1) | |
Include(m => (m as Child2).Property1) | |
.ToListAsync(); |
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
<label for="my-lovely-checkbox">Some label text</label> | |
<input type="checkbox" id="my-lovely-checkbox" /> |
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
export class MoviesComponent { | |
constructor() {} | |
getMovies(): void { | |
this.http.get('http://example.com/movies.json').toPromise().then((response) => { | |
console.log(response); | |
}); | |
} |
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
// delegate to your own implementation | |
spyOn(MoviesComponent, 'getMovies').and.callFake(() => {}); | |
//delegate to your own implementation with an argument | |
spyOn(MoviesComponent, 'getMovies').withArgs('').and.callFake(() => {}); | |
//return a specific value 'false' | |
spyon(MoviesComponent, 'getMovies').and.returnValue({movies: ['terminator', 'titanic', 'avatar']}}); | |
//delegate to the actual implementation |
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
this.blogs.forEach((blog: any) => { delete blog.__typename; }); |
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
public class AuthenticationHelper : IAuthenticationHelper | |
{ | |
static string ApplicationName = "APPLICATIONNAME"; | |
static string RefreshToken = "YOURREFRESHTOKEN"; | |
public DriveService Authenticate() | |
{ | |
var token = new TokenResponse | |
{ | |
RefreshToken = RefreshToken |