コード例 #1
0
 public void MergeFrom(NoEventsHasChildEvents other)
 {
     if (other == null)
     {
         return;
     }
     if (other.hasA_ != null)
     {
         if (hasA_ == null)
         {
             hasA_ = new global::Com.Zynga.Runtime.Protobuf.HasEvents();
         }
         HasA.MergeFrom(other.HasA);
     }
     switch (other.FooCase)
     {
     case FooOneofCase.HasB:
         if (HasB == null)
         {
             HasB = new global::Com.Zynga.Runtime.Protobuf.HasEvents();
         }
         HasB.MergeFrom(other.HasB);
         break;
     }
 }
コード例 #2
0
ファイル: FindTests.cs プロジェクト: AndrewWD1/RamdatNet
        public void FindTests_Docs()
        {
            HasA[] xs = { new HasA(1), new HasA(2), new HasA(3) };

            var result1   = R.Find(R.PropEq <HasA, int>("A", 2))(xs);
            var expected1 = new HasA(2);

            var result2 = R.Find(R.PropEq <HasA, int>("A", 4))(xs);

            Assert.IsTrue(result1.CompareTo(expected1) == 0);
            Assert.AreEqual(result2, null);
        }
コード例 #3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (hasA_ != null)
            {
                hash ^= HasA.GetHashCode();
            }
            if (fooCase_ == FooOneofCase.HasB)
            {
                hash ^= HasB.GetHashCode();
            }
            hash ^= (int)fooCase_;
            return(hash);
        }
コード例 #4
0
        public void AddProductToMyStore_BananIsAlreadyInStore_ReturnMinusOne()
        {
            var hasA = new HasA()
            {
                Price     = 1,
                Product   = _product,
                ProductId = _product.ProductId,
                Store     = _store,
                StoreId   = _store.StoreId
            };

            _unitWork.HasA.Get(_store.StoreId, _product.ProductId).Returns(hasA);

            Assert.That(_uut.AddProductToMyStore(_product, 3.95), Is.EqualTo(-1));
        }
コード例 #5
0
ファイル: Storemanager.cs プロジェクト: perovsing/Database
        public int AddProductToMyStore(Product product, double price)
        {
            if (_unitwork.HasA.Get(Store.StoreId, product.ProductId) != null)
                return -1;

            var hasA = new HasA
            {
                Price = price,
                Product = product,
                Store = Store,
                ProductId = product.ProductId,
                StoreId = Store.StoreId
            };

            _unitwork.HasA.Add(hasA);

            _unitwork.Complete();
            return 0;
        }