public void HandleValid() { var cmd = new AddClientCommand() { GivenName = "Paul", SurName = "Glenn", }; _handler.Handle(cmd); }
public void HandleValid() { var cmd = new AddClientCommand() { GivenName = "Paul", SurName = "Glenn", }; _handler.Handle(cmd); var ctx = (ClientDataContext) _handler.DbContext; Assert.AreEqual(1, ctx.BeginCount); Assert.AreEqual(1, ctx.CommitCount); Assert.AreEqual(0, ctx.RollbackCount); }
public void ValidateInvalid() { var cmd = new AddClientCommand() { SurName = "Glenn" }; try { _handler.Handle(cmd); } catch (AggregateException ex) { if (ex.InnerExceptions.Count != 1 || !(ex.InnerExceptions[0] is ValidationException) || !ex.InnerExceptions[0].Message.Contains("GivenName")) Assert.Fail(); } }
public void ValidateObject_IsInvalid() { var q = new AddClientCommand() { GivenName = "Paul", SurName = "Glenn", Address = new Address2() { City = "London", Street = "Padington", House = 7} }; try { _handler.Handle(q); } catch (AggregateException ex) { if (ex.InnerExceptions.Count != 1 || !(ex.InnerExceptions[0] is ValidationException) || !ex.InnerExceptions[0].Message.Contains("Flat")) Assert.Fail(); } }
public void HandleInvalid() { var cmd = new AddClientCommand() { SurName = "Glenn" }; try { _handler.Handle(cmd); } catch (AggregateException ex) { } var ctx = (ClientDataContext)_handler.DbContext; Assert.AreEqual(1, ctx.BeginCount); Assert.AreEqual(0, ctx.CommitCount); Assert.AreEqual(1, ctx.RollbackCount); }
public void ValidateObject_IsValid() { var cmd = new AddClientCommand() { GivenName = "Paul", SurName = "Glenn", Address = new Address2() { City = "London", Street = "Padington", House = 7, Flat = 11 } }; _handler.Handle(cmd); }