Пример #1
0
        public void FindOne()
        {
            var models = this.AddMockModels();
            var model  = models.RandomOne();

            var command = new CMD.FindOne <Models.Member>(model.Id);

            Assert.Null(GA.Compare(model, this.Execute(command).ResultValue));
        }
Пример #2
0
        public void FindOne()
        {
            var models = this.AddMockModels();
            var model  = models.RandomOne();

            var command = new CMD.FindOne <Models.Member, Models.Member> {
                Where = this.Engine.GetRemoveWhere <Models.Member>(model.Id)
            };

            Assert.Null(GA.Compare(model, this.Execute(command).Result));
        }
Пример #3
0
 public static void AssertObject(this object expected, object actual)
 {
     if (!object.Equals(expected, actual))
     {
         var cr = GA.Compare(expected, actual);
         if (cr != null)
         {
             Assert.Fail(cr.ToString());
         }
     }
 }
Пример #4
0
        public void FindOneWhere()
        {
            var models = this.AddMockModels();
            var model  = models.RandomOne();

            var command = new CMD.FindOne <Models.Member, Models.Member>()
            {
                Where = WhereParameters.Parse(this.Engine, new { model.IdCard, model.Email })
            };

            Assert.Null(GA.Compare(model, this.Execute(command).Result));
        }
Пример #5
0
        public void Add()
        {
            var model = GA.CreateMockModel <Models.Member>();

            model.Id = 0;
            var command = new CMD.Add <Models.Member> {
                Entity = model
            };

            Assert.Equal(1, this.Execute(command).Result);
            Assert.Equal(1, this.Execute(new CMD.GetIdentity <Models.Member>()).Result);
            var r = GA.Compare(model, this.Context.FindOne <Models.Member>(1));

            Assert.Null(r);
        }