public void AdministratorAddMany() { // Arrange var administrator = new Persons(this.Session).FindBy(Persons.Meta.UserName, Users.AdministratorUserName); var c1a = new C1Builder(this.Session) .Build(); var c1b = new C1Builder(this.Session) .Build(); var c1c = new C1Builder(this.Session) .Build(); c1a.AddC1C1One2Many(c1b); this.Session.Derive(); this.Session.Commit(); var saveRequest = new SaveRequest { Objects = new[] { new SaveRequestObject { I = c1a.Id.ToString(), V = c1a.Strategy.ObjectVersion.ToString(), Roles = new List<SaveRequestRole> { new SaveRequestRole { T = "C1C1One2Many", A = new [] { c1c.Id.ToString() } } } } } }; var controller = new AngularController { AllorsSession = this.Session, AuthenticatedUser = administrator }; // Act var jsonResult = (JsonResult)controller.Save(saveRequest); var saveResponse = (SaveResponse)jsonResult.Data; // Assert this.Session.Rollback(); saveResponse.Errors.Count.ShouldEqual(0); c1a.C1C1One2Manies.ShouldNotBeSameAs(new[] { c1b, c1c }); }
public void GuestSetUnit() { // Arrange var c1a = new C1Builder(this.Session) .WithC1AllorsString("c1") .WithI1AllorsString("i1") .WithI12AllorsString("i12") .Build(); this.Session.Derive(); this.Session.Commit(); var saveRequest = new SaveRequest { Objects = new[] { new SaveRequestObject { I = c1a.Id.ToString(), V = c1a.Strategy.ObjectVersion.ToString(), Roles = new List<SaveRequestRole> { new SaveRequestRole { T = "C1AllorsString", S = "new c1" } } } } }; var controller = new AngularController { AllorsSession = this.Session }; // Act var jsonResult = (JsonResult)controller.Save(saveRequest); var saveResponse = (SaveResponse)jsonResult.Data; // Assert this.Session.Rollback(); saveResponse.Errors.Count.ShouldEqual(1); c1a.C1AllorsString.ShouldEqual("c1"); }