public void Should_be_able_to_create_and_retrieve_Parent() { var parent = new RavenDbRepositoryWithTypedId<Parent, string>(session).Get(parentId); parent.ShouldNotBeNull(); parent.Name.ShouldEqual("Mike Hadlow"); parent.UserName.ShouldEqual("*****@*****.**"); parent.Children.ShouldNotBeNull(); }
public void Should_be_able_to_create_and_retrieve_a_child() { var child = new RavenDbRepositoryWithTypedId<Child, string>(session).Get(childId); child.Name.ShouldEqual("Leo"); child.UserName.ShouldEqual("leohadlow"); child.ParentId.ShouldEqual(parentId); child.Password.ShouldEqual("xxx"); child.Account.ShouldNotBeNull(); }
public void Should_be_able_to_create_and_retrieve_Parent() { var parent = new RavenDbRepositoryWithTypedId <Parent, string>(session).Get(parentId); parent.ShouldNotBeNull(); parent.Name.ShouldEqual("Mike Hadlow"); parent.UserName.ShouldEqual("*****@*****.**"); parent.Children.ShouldNotBeNull(); }
public void Should_be_able_to_add_transaction_to_account() { IRepositoryWithTypedId<Child, string> childRepository = new RavenDbRepositoryWithTypedId<Child, string>(session); var childToTestOn = childRepository.Get(childId); childToTestOn.ReceivePayment(10, "Reward"); FlushSessionAndEvict(childToTestOn); var child = childRepository.Get(childId); Assert.Greater(child.Account.Transactions.Count, 0); }
public void Should_be_able_to_create_and_retrieve_a_child() { var child = new RavenDbRepositoryWithTypedId <Child, string>(session).Get(childId); child.Name.ShouldEqual("Leo"); child.UserName.ShouldEqual("leohadlow"); child.ParentId.ShouldEqual(parentId); child.Password.ShouldEqual("xxx"); child.Account.ShouldNotBeNull(); }
public void Should_be_able_to_add_transaction_to_account() { IRepositoryWithTypedId <Child, string> childRepository = new RavenDbRepositoryWithTypedId <Child, string>(session); var childToTestOn = childRepository.Get(childId); childToTestOn.ReceivePayment(10, "Reward"); FlushSessionAndEvict(childToTestOn); var child = childRepository.Get(childId); Assert.Greater(child.Account.Transactions.Count, 0); }
public void Should_be_able_to_add_a_message_to_a_user() { var parentRepository = new RavenDbRepositoryWithTypedId<Parent,string>(session); User userToTestWith = parentRepository.Get(userId); userToTestWith.SendMessage("some message"); FlushSessionAndEvict(userToTestWith); var parent = parentRepository.Get(userId); parent.Messages.Count.ShouldEqual(1); }
public void Should_be_able_to_add_a_message_to_a_user() { var parentRepository = new RavenDbRepositoryWithTypedId <Parent, string>(session); User userToTestWith = parentRepository.Get(userId); userToTestWith.SendMessage("some message"); FlushSessionAndEvict(userToTestWith); var parent = parentRepository.Get(userId); parent.Messages.Count.ShouldEqual(1); }
public void Should_be_able_to_add_a_child_to_a_parent() { var linqRepository = new RavenDbRepositoryWithTypedId<Parent, string>(session); var savedParent = linqRepository.Get(parentId); savedParent.CreateChild("jim", "jim123", "passw0rd1"); savedParent.CreateChild("jenny", "jenny123", "passw0rd2"); savedParent.CreateChild("jez", "jez123", "passw0rd3"); this.FlushSessionAndEvict(savedParent); var parent = linqRepository.Get(parentId); parent.Children.Count.ShouldEqual(3); parent.Children[0].ShouldEqual("Users/jim123"); parent.Children[1].ShouldEqual("Users/jenny123"); parent.Children[2].ShouldEqual("Users/jez123"); }
public void Should_be_able_to_add_schedule_to_account() { ILinqRepositoryWithTypedId<Child, string> childRepository = new RavenDbRepositoryWithTypedId<Child, string>(session); var childToTestOn = childRepository.FindOne(childId); Assert.AreEqual(0, childToTestOn.Account.PaymentSchedules.Count); if (childToTestOn == null) { childToTestOn = session.Load<Child>("children/" + childId); } childToTestOn.Account.AddPaymentSchedule(DateTime.UtcNow, Interval.Week, 10, "Weekly pocket money"); FlushSessionAndEvict(childToTestOn); var child = childRepository.FindOne(childId); Assert.Greater(child.Account.PaymentSchedules.Count, 0); }
public void Should_be_able_to_add_a_child_to_a_parent() { var linqRepository = new RavenDbRepositoryWithTypedId <Parent, string>(session); var savedParent = linqRepository.Get(parentId); savedParent.CreateChild("jim", "jim123", "passw0rd1"); savedParent.CreateChild("jenny", "jenny123", "passw0rd2"); savedParent.CreateChild("jez", "jez123", "passw0rd3"); this.FlushSessionAndEvict(savedParent); var parent = linqRepository.Get(parentId); parent.Children.Count.ShouldEqual(3); parent.Children[0].ShouldEqual("Users/jim123"); parent.Children[1].ShouldEqual("Users/jenny123"); parent.Children[2].ShouldEqual("Users/jez123"); }
public void Should_be_able_to_add_schedule_to_account() { ILinqRepositoryWithTypedId <Child, string> childRepository = new RavenDbRepositoryWithTypedId <Child, string>(session); var childToTestOn = childRepository.FindOne(childId); Assert.AreEqual(0, childToTestOn.Account.PaymentSchedules.Count); if (childToTestOn == null) { childToTestOn = session.Load <Child>("children/" + childId); } childToTestOn.Account.AddPaymentSchedule(DateTime.UtcNow, Interval.Week, 10, "Weekly pocket money"); FlushSessionAndEvict(childToTestOn); var child = childRepository.FindOne(childId); Assert.Greater(child.Account.PaymentSchedules.Count, 0); }