Ejemplo n.º 1
0
        public void TestGetAll()
        {
            Topic topic = TopicBuilder.New().WithName("Skate").Build();

            new CreateTopic().CreateNewRegister(topic);
            var idGet = new GetTopic().GetRegisterById(topic.Id);

            Assert.IsNotNull(idGet);
        }
Ejemplo n.º 2
0
        public void TestCreate()
        {
            Topic topic            = TopicBuilder.New().WithName("Skate").Build();
            var   resultValidation = new TopicValidator().Validate(topic);

            if (resultValidation.IsValid)
            {
                // Conhecimento MemoryCache
                CacheItemPolicy policy = new CacheItemPolicy();
                policy.AbsoluteExpiration = DateTimeOffset.Now.AddSeconds(60);
                Assert.IsTrue(memoryCache.Add("topic", topic, policy));

                // Produção através dos métodos
                new CreateTopic().CreateNewRegister(topic);
                var idGet = new GetTopic().GetRegisterById(topic.Id);
                Assert.IsNotNull(idGet);
            }
        }