Example #1
0
        public static void Add(UnitCarrier one, UnitCarrier other)
        {
            if (contexts2 == null)
            {
                contexts2 = new List <Context2>();
            }
            Context2 context = new Context2();

            context.Self  = one;
            context.Other = other;
            contexts2.Add(context);
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ Context2.GetHashCode();
         hashCode = (hashCode * 397) ^ ProposalCollection.GetHashCode();
         hashCode = (hashCode * 397) ^ Selections.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)TerminatedBy;
         hashCode = (hashCode * 397) ^ (int)TerminatedState;
         return(hashCode);
     }
 }
Example #3
0
        public void InterpreterPrtternCodeTest()
        {
            Context2           context     = new Context2();
            List <Expression1> expressions = new List <Expression1>();

            expressions.Add(new TerminalExpression());
            expressions.Add(new NonterminalExpression());
            expressions.Add(new TerminalExpression());
            expressions.Add(new TerminalExpression());

            foreach (var expression in expressions)
            {
                expression.Interpret(context);
            }
        }
Example #4
0
        public void CanSoftDelete()
        {
            //Arrange
            int id;

            using (var db = new Context2())
            {
                var p = new Product();

                db.Products.Add(p);

                var q = new Quote
                {
                    Name         = "CanSoftDelete",
                    QuoteDetails = new[]
                    {
                        new QuoteDetail {
                            Name = "Item 1", Product = p
                        },
                        new QuoteDetail {
                            Name = "Item 2", Product = p
                        }
                    }
                };

                db.Quotes.Add(q);
                db.SaveChanges();
                id = q.Id;
            }

            //Act
            using (var db = new Context2())
            {
                var q = db.Quotes.Single(x => x.Id == id);
                db.Quotes.Remove(q);
                db.SaveChanges();
            }

            //Assert
            using (var db = new Context2())
            {
                Assert.That(db.Quotes.Any(x => x.Id == id), Is.False);
            }
        }
Example #5
0
 public void Run()
 {
     using (DbConnection connection = GetConnection())
     {
         using (var context = new Context1(connection))
         {
             context.MyEntities.Count();
         }
         using (var context = new Context2(connection))
         {
             context.MyEntities.Count();
             context.MyEntities.Where(_ => _.Description2.Contains("a")).Count();
         }
         using (var context = new Context2(connection))
         {
             context.MyEntities.Where(_ => _.Description2.Contains("a")).Count();
         }
     }
 }
Example #6
0
        public async Task <PostDto> AddPostAsync(PostDto post)
        {
            string Id = httpContextAccessor.HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier);

            var Account = await Context2.Find(x => x.SecurId == Id).SingleOrDefaultAsync();

            Account = Account ?? new Identity();
            var set = new Post()
            {
                Date  = post.Date,
                Title = post.Title,
                Tags  = post.Tags,
                Views = post.Views,

                AccountId   = Account.Id,
                AccountName = Account.FisrtName + " " + Account.SureName,
                AccountType = Account.Type,


                PostType       = post.PostType,
                Availabilty    = post.Availabilty,
                Categories     = post.Categories,
                Comments       = post.Comments,
                Descreption    = post.Descreption,
                Hours          = post.Hours,
                KindPay        = post.KindPay,
                Likes          = post.Likes,
                Region         = post.Region,
                Sallaries      = post.Sallaries,
                Skills         = post.Skills,
                Specifications = post.Specifications
            };
            await Context1.InsertOneAsync(set);

            post.Id = set.Id;
            return(post);
        }