public void ComplexSpecification(PersonEntity data, bool valid, string message)
        {
            ComplexSpecificationValidation validation = new ComplexSpecificationValidation();
            bool result = validation.IsSatisfiedBy(data);

            valid.Should().Be(result, message);
        }
        public void ComplexSpecificationWithExecute(PersonEntity data, bool valid, string message)
        {
            ComplexSpecificationValidation validation = new ComplexSpecificationValidation();
            Execute execute = new Execute();
            bool result = validation.IsSatisfiedBy(data, execute);

            valid.Should().Be(result, message);
            valid.Should().Be(!execute.HasErro, message);
        }
        public void PutValueObject()
        {
            PersonEntity person = new PersonEntity
            {
                Action = EntityAction.None,
                Id = "1".ToGuid(),
                Age = 35,
                Name = "Marvio",
                Email = "*****@*****.**",
            };

            Cache.Put(person);

            var result = Cache.Get<PersonEntity>();

            result.Should().Be(person);
        }
 public void QueryOrder(List<PersonEntity> source, PersonFilter filter, PersonEntity expected, string message)
 {
     var result = Specification.Build(source, filter);
     result.Count().Should().Be(1);
     result.First().ShouldBeEquivalentTo(expected);
 }
        public void PutValueObjectCheckReference()
        {
            PersonEntity person = new PersonEntity
            {
                Action = EntityAction.None,
                Id = "1".ToGuid(),
                Age = 35,
                Name = "Marvio",
                Email = "*****@*****.**",
            };

            Cache.Put(person);

            person.Id = "2".ToGuid();
            person.Name = "Marvio Andre";

            PersonEntity result = Cache.Get<PersonEntity>();

            result.Id.Should().Be(person.Id);
            result.Name.Should().Be(person.Name);
        }
        public void ExpireCacheTimeSpan()
        {
            string key = "ObjectRefTest";

            PersonEntity person = new PersonEntity
            {
                Action = EntityAction.None,
                Id = "1".ToGuid(),
                Age = 35,
                Name = "Marvio",
                Email = "*****@*****.**",
            };

            Cache.Put(key, person, TimeSpan.FromMinutes(-10));

            PersonEntity result = Cache.Get<PersonEntity>(key);

            result.Should().Be(null);
        }
        public void NotExpireCacheDateTime()
        {
            string key = "ObjectRefTest";

            PersonEntity person = new PersonEntity
            {
                Action = EntityAction.None,
                Id = "1".ToGuid(),
                Age = 35,
                Name = "Marvio",
                Email = "*****@*****.**",
            };

            Cache.Put(key, person, DateTime.Now.AddDays(1));

            PersonEntity result = Cache.Get<PersonEntity>(key);

            result.Should().Be(person);
        }
        public void PutValueWithKeyObject()
        {
            string key = "ObjectTest";
            
            PersonEntity person = new PersonEntity
            {
                Action = EntityAction.None,
                Id = "1".ToGuid(),
                Age = 35,
                Name = "Marvio",
                Email = "*****@*****.**",
            };

            Cache.Put(key, person);

            var result = Cache.Get<PersonEntity>(key);

            result.Should().Be(person);
        }