Example #1
0
 public void When(SecurityPasswordAdded e)
 {
     _writer.UpdateEnforcingNew(unit.it, view => view.Items.Add(new User()
     {
         Login = e.Login
     }));
 }
Example #2
0
        public void created_new_instance_when_call_update_method_and_key_not_found()
        {
            var key      = Guid.NewGuid();
            var newValue = _guidKeyClassWriter.UpdateEnforcingNew(key, tv => { tv.Value += 1; });

            var defaultValue = default(int);

            Assert.AreEqual(defaultValue + 1, newValue.Value);
        }
Example #3
0
 public void When(DailyTaskScheduled e)
 {
     _writer.UpdateEnforcingNew(e.GoalId, g =>
     {
         Day day;
         if (g.Days.ContainsKey(e.Id))
         {
             g.Days.TryGetValue(e.Id, out day);
             day.Description = e.Description;
             day.TaskDate    = e.TaskDate;
         }
         else
         {
             g.Days.Add(e.Id, new Day()
             {
                 Description = e.Description,
                 TaskDate    = e.TaskDate
             });
         }
     });
 }
Example #4
0
 public static TView UpdateEnforcingNew <TView>(this IDocumentWriter <unit, TView> self, Action <TView> update, AddOrUpdateHint hint = AddOrUpdateHint.ProbablyExists)
     where TView : new()
 {
     return(self.UpdateEnforcingNew(unit.it, update, hint));
 }
Example #5
0
 public void When(SecurityPasswordAdded e)
 {
     _writer.UpdateEnforcingNew(unit.it, si => si.Logins[e.Login] = e.UserId.Id);
 }
 public void When(InstanceStarted e)
 {
     _writer.UpdateEnforcingNew(v => v.List.Add(e.CodeVersion));
 }