public void CanCastConcreteLinqRepositoryToInterfaceILinqRepository()
        {
            LinqRepository <MyEntity>  concreteRepository = new LinqRepository <MyEntity>();
            ILinqRepository <MyEntity> castRepository     = concreteRepository as ILinqRepository <MyEntity>;

            castRepository.ShouldNotBeNull();
        }
 public void Should_be_able_to_create_and_retrieve_Parent()
 {
     Parent parent = new LinqRepository<Parent>(TransactionManager, Session).Get(parentId);
     parent.Should().NotBeNull();
     parent.Name.Should().Be("Mike Hadlow");
     parent.UserName.Should().Be("*****@*****.**");
     parent.Children.Should().NotBeNull();
 }
        public void CanCastConcreteLinqRepositoryToInterfaceILinqRepository()
        {
            var session            = new Mock <ISession>();
            var transactionManager = new Mock <ITransactionManager>();
            var concreteRepository = new LinqRepository <MyEntity>(transactionManager.Object, session.Object);

            concreteRepository.Should().BeAssignableTo <ILinqRepository <MyEntity> >();
        }
        public void CanCastConcreteLinqRepositoryToInterfaceILinqRepository()
        {
            var session = new Mock<ISession>();
            var transactionManager = new Mock<ITransactionManager>();
            var concreteRepository = new LinqRepository<MyEntity>(transactionManager.Object, session.Object);

            concreteRepository.Should().BeAssignableTo<ILinqRepository<MyEntity>>();
        }
        public void Should_be_able_to_create_and_retrieve_Parent()
        {
            Parent parent = new LinqRepository <Parent>(TransactionManager, Session).Get(parentId);

            parent.Should().NotBeNull();
            parent.Name.Should().Be("Mike Hadlow");
            parent.UserName.Should().Be("*****@*****.**");
            parent.Children.Should().NotBeNull();
        }
 public void Should_be_able_to_create_and_retrieve_a_child()
 {
     var child = new LinqRepository<Child>(TransactionManager, Session).Get(childId);
     child.Name.Should().Be("Leo");
     child.UserName.Should().Be("leohadlow");
     child.ParentId.Should().Be(parentId);
     child.Password.Should().Be("xxx");
     child.Account.Should().NotBeNull();
 }
Exemplo n.º 7
0
        public void CanCastConcreteLinqRepositoryToInterfaceILinqRepository()
        {
            var session            = new Mock <ISession>();
            var transactionManager = new Mock <INHibernateTransactionManager>();

            transactionManager.SetupGet(t => t.Session).Returns(session.Object);
            var concreteRepository = new LinqRepository <MyEntity>(transactionManager.Object);

            concreteRepository.Should().BeAssignableTo <ILinqRepository <MyEntity> >();
        }
        public void Should_be_able_to_add_schedule_to_account()
        {
            var childRepository = new LinqRepository<Child>(TransactionManager, Session);
            var childToTestOn = childRepository.Get(childId);
            childToTestOn.Account.AddPaymentSchedule(DateTime.UtcNow, Interval.Week, 10, "Weekly pocket money");
            FlushSessionAndEvict(childToTestOn);

            var child = childRepository.Get(childId);
            child.Account.PaymentSchedules[0].Id.Should().BePositive("schedule was not persisted");
        }
        public void Should_be_able_to_add_transaction_to_account()
        {
            var childRepository = new LinqRepository<Child>(TransactionManager, Session);
            var childToTestOn = childRepository.Get(childId);
            childToTestOn.ReceivePayment(10, "Reward");
            FlushSessionAndEvict(childToTestOn);

            var child = childRepository.Get(childId);
            child.Account.Transactions[0].Id.Should().BePositive();
        }
Exemplo n.º 10
0
        public void Should_be_able_to_create_and_retrieve_a_child()
        {
            var child = new LinqRepository <Child>(TransactionManager, Session).Get(childId);

            child.Name.Should().Be("Leo");
            child.UserName.Should().Be("leohadlow");
            child.ParentId.Should().Be(parentId);
            child.Password.Should().Be("xxx");
            child.Account.Should().NotBeNull();
        }
Exemplo n.º 11
0
        public void Should_be_able_to_add_transaction_to_account()
        {
            var childRepository = new LinqRepository <Child>(TransactionManager, Session);
            var childToTestOn   = childRepository.Get(childId);

            childToTestOn.ReceivePayment(10, "Reward");
            FlushSessionAndEvict(childToTestOn);

            var child = childRepository.Get(childId);

            child.Account.Transactions[0].Id.Should().BePositive();
        }
Exemplo n.º 12
0
        public void Should_be_able_to_add_schedule_to_account()
        {
            var childRepository = new LinqRepository <Child>(TransactionManager, Session);
            var childToTestOn   = childRepository.Get(childId);

            childToTestOn.Account.AddPaymentSchedule(DateTime.UtcNow, Interval.Week, 10, "Weekly pocket money");
            FlushSessionAndEvict(childToTestOn);

            var child = childRepository.Get(childId);

            child.Account.PaymentSchedules[0].Id.Should().BePositive("schedule was not persisted");
        }
        public void Should_be_able_to_add_a_message_to_a_user()
        {
            var parentRepository = new LinqRepository<Parent>(TransactionManager, Session);
            User userToTestWith = parentRepository.Get(userId);

            userToTestWith.SendMessage("some message", this.mediator.Object);

            FlushSessionAndEvict(userToTestWith);

            Parent parent = parentRepository.Get(userId);
            parent.Messages.Count.Should().Be(1);
        }
Exemplo n.º 14
0
        public async Task Should_be_able_to_add_a_message_to_a_user()
        {
            var  parentRepository = new LinqRepository <Parent, int>(TransactionManager);
            User userToTestWith   = await parentRepository.GetAsync(_userId);

            userToTestWith.SendMessage("some message", _mediator.Object);

            await FlushSessionAndEvict(userToTestWith);

            Parent parent = await parentRepository.GetAsync(_userId);

            parent.Messages.Count.Should().Be(1);
        }
Exemplo n.º 15
0
        public void Should_be_able_to_add_a_message_to_a_user()
        {
            var  parentRepository = new LinqRepository <Parent>(TransactionManager, Session);
            User userToTestWith   = parentRepository.Get(userId);

            userToTestWith.SendMessage("some message", this.mediator.Object);

            FlushSessionAndEvict(userToTestWith);


            Parent parent = parentRepository.Get(userId);

            parent.Messages.Count.Should().Be(1);
        }
        public void Should_be_able_to_add_a_child_to_a_parent()
        {
            var linqRepository = new LinqRepository<Parent>(TransactionManager, Session);
            Parent savedParent = linqRepository.Get(parentId);
            savedParent.CreateChild("jim", "jim123", "passw0rd1");
            savedParent.CreateChild("jenny", "jenny123", "passw0rd2");
            savedParent.CreateChild("jez", "jez123", "passw0rd3");
            this.FlushSessionAndEvict(savedParent);

            Parent parent = linqRepository.Get(parentId);
            parent.Children.Count.Should().Be(3);

            parent.Children[0].Name.Should().Be("jim");
            parent.Children[1].Name.Should().Be("jenny");
            parent.Children[2].Name.Should().Be("jez");
        }
Exemplo n.º 17
0
        public void Should_be_able_to_add_a_child_to_a_parent()
        {
            var    linqRepository = new LinqRepository <Parent>(TransactionManager, Session);
            Parent savedParent    = linqRepository.Get(parentId);

            savedParent.CreateChild("jim", "jim123", "passw0rd1");
            savedParent.CreateChild("jenny", "jenny123", "passw0rd2");
            savedParent.CreateChild("jez", "jez123", "passw0rd3");
            this.FlushSessionAndEvict(savedParent);


            Parent parent = linqRepository.Get(parentId);

            parent.Children.Count.Should().Be(3);

            parent.Children[0].Name.Should().Be("jim");
            parent.Children[1].Name.Should().Be("jenny");
            parent.Children[2].Name.Should().Be("jez");
        }
Exemplo n.º 18
0
        public async Task Should_be_able_to_add_a_child_to_a_parent()
        {
            var    linqRepository = new LinqRepository <Parent, int>(TransactionManager);
            Parent savedParent    = await linqRepository.GetAsync(_parentId);

            savedParent.Should().NotBeNull();

            savedParent.CreateChild("jim", "jim123", "passw0rd1");
            savedParent.CreateChild("jenny", "jenny123", "passw0rd2");
            savedParent.CreateChild("jez", "jez123", "passw0rd3");
            await FlushSessionAndEvict(savedParent);

            Parent parent = await linqRepository.GetAsync(_parentId);

            parent.Children.Count.Should().Be(3);

            parent.Children[0].Name.Should().Be("jim");
            parent.Children[1].Name.Should().Be("jenny");
            parent.Children[2].Name.Should().Be("jez");
        }
Exemplo n.º 19
0
 public LinqAppService(LinqRepository repo)
 {
     this.repo = repo;
 }
Exemplo n.º 20
0
		public LinqAppService(LinqRepository repo)
		{
			this.repo = repo;
		}
Exemplo n.º 21
0
 /// <inheritdoc />
 public ChildTests(TransientDatabaseSetup dbSetup)
     : base(dbSetup)
 {
     _childRepository = new LinqRepository <Child, int>(TransactionManager);
 }
Exemplo n.º 22
0
 public void CanCastConcreteLinqRepositoryToInterfaceILinqRepository()
 {
     LinqRepository<MyEntity> concreteRepository = new LinqRepository<MyEntity>();
     ILinqRepository<MyEntity> castRepository = concreteRepository as ILinqRepository<MyEntity>;
     castRepository.ShouldNotBeNull();
 }