- Scala syntax
5 questions - should be enough (?), there are question for beginner, intermediate and more advanced stuff. If not enough, more possible themes: type tags, dependent types...
- How well do you know Option/Try/Either types from Scala standard library?
- I heard about them, but I don't see clear benefits
- I use them and understand the benefits, but I struggle with them
- I fully understand why we use them and have no problems with them
- How do you get and combine values from those types mentioned above?
- I don't
- I use map/flatMap most of the time
- How well do you know Option/Try/Either types from Scala standard library?
- I try using for-comprehension most of the time
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
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Linq; | |
using System.Linq.Expressions; | |
namespace MongoDB.Migrations | |
{ | |
public class MigratableObject : ISupportInitialize | |
{ |
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 events = db.GetCollection("events"); | |
events.Insert(new Event {Id = "1", Payload = 2}); | |
events.Insert(new Event {Id = "1", Payload = 3}, SafeMode.True); |
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
[Subject("Mongo")] | |
public class when_issuing_an_update_on_a_changed_entity : mongo_context | |
{ | |
private static long DocumentsAffected; | |
private Establish context = () => SetUpDatabase(); | |
private Because of = () => DocumentsAffected = UpdateSameObjectTwice(); | |
private It should_not_affect_any_documents = () => Assert.That(DocumentsAffected, Is.EqualTo(0)); | |
private static long UpdateSameObjectTwice() |
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
[Subject("Raven Experiments")] | |
public class when_storing_two_objects_with_same_id_in_separate_sessions : raven_persistence_context | |
{ | |
static Exception Exception; | |
Because of = () => Exception = Catch.Exception(CreateTwoObjectsInTwoSessions); | |
It should_throw_concurrency_exception = () => Exception.ShouldBeOfType<ConcurrencyException>(); | |
static void CreateTwoObjectsInTwoSessions() | |
{ |
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
[Subject("Raven Experiments")] | |
public class when_updating_same_object_in_separate_sessions : raven_persistence_context | |
{ | |
static Exception Exception; | |
Establish context = () => StoreSingleObject(new MyClass {Text = "this one"}); | |
Because of = () => Exception = Catch.Exception(UpdateTwoObjectsInTwoSessions); | |
It should_throw_concurrency_exception = () => Exception.ShouldBeOfType<ConcurrencyException>(); | |
static void UpdateTwoObjectsInTwoSessions() |
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
typeof (Convert) | |
.GetMethods(BindingFlags.Static|BindingFlags.Public) | |
.Where(m=>m.Name.StartsWith("To")) | |
.Select(m=>m.GetParameters().First().ParameterType) | |
.Distinct() |