コード例 #1
0
        public void Compare_Descending()
        {
            var domainObject1 = DomainObjectMother.CreateFakeObject <Order> ();
            var domainObject2 = DomainObjectMother.CreateFakeObject <Order> ();

            PrepareDataContainer(_dataManagerStub, domainObject1, 1);
            PrepareDataContainer(_dataManagerStub, domainObject2, 2);

            var specification = new SortedPropertySpecification(_orderNumberPropertyDefinition, SortOrder.Descending);
            var comparer      = new SortedPropertyComparer(specification, _dataManagerStub);

            Assert.That(comparer.Compare(domainObject1, domainObject1), Is.EqualTo(0));
            Assert.That(comparer.Compare(domainObject1, domainObject2), Is.EqualTo(1));
            Assert.That(comparer.Compare(domainObject2, domainObject1), Is.EqualTo(-1));
            Assert.That(comparer.Compare(domainObject2, domainObject2), Is.EqualTo(0));
        }
コード例 #2
0
        public void Compare_DoesNotTriggerEvents()
        {
            var domainObject1 = DomainObjectMother.CreateFakeObject <Order> ();
            var domainObject2 = DomainObjectMother.CreateFakeObject <Order> ();

            var dataContainer1 = PrepareDataContainer(_dataManagerStub, domainObject1, 1);
            var dataContainer2 = PrepareDataContainer(_dataManagerStub, domainObject2, 2);

            var transaction = ClientTransaction.CreateRootTransaction();

            ClientTransactionTestHelper.RegisterDataContainer(transaction, dataContainer1);
            ClientTransactionTestHelper.RegisterDataContainer(transaction, dataContainer2);

            ClientTransactionTestHelperWithMocks.EnsureTransactionThrowsOnEvents(transaction);

            var specification = new SortedPropertySpecification(_orderNumberPropertyDefinition, SortOrder.Descending);
            var comparer      = new SortedPropertyComparer(specification, _dataManagerStub);

            Assert.That(comparer.Compare(domainObject1, domainObject1), Is.EqualTo(0));
        }