Beispiel #1
0
        public void UdateIndicatorStringValeExpresionEqualNotOk()
        {
            Guid   id    = Guid.NewGuid();
            string color = "red";
            Value  izq   = new StringValue {
                Data = "hola"
            };
            Value der = new StringValue {
                Data = "hola"
            };
            BaseCondition component = new Condition
            {
                ValueIzq = izq,
                ValueDer = der,
                Operator = "="
            };
            Indicator indicator = new Indicator {
                Color     = color,
                Id        = id,
                Condition = component
            };
            var context = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            IRepository <Indicator> indicatorRepo  = new IndicatorRepository(context);
            IndicatorLogic          indicatroLogic = new IndicatorLogic(indicatorRepo);

            indicatroLogic.Update(indicator);
        }
Beispiel #2
0
        public void UpdateIndicatorStringValeExpresionEqualmockOk()
        {
            Guid   id    = Guid.NewGuid();
            string color = "red";
            Value  izq   = new StringValue {
                Data = "hola"
            };
            Value der = new StringValue {
                Data = "hola"
            };
            BaseCondition component = new Condition
            {
                ValueIzq = izq,
                ValueDer = der,
                Operator = "="
            };
            Indicator indicator = new Indicator {
                Color     = color,
                Id        = id,
                Condition = component
            };
            var mock = new Mock <IRepository <Indicator> >(MockBehavior.Strict);

            mock.Setup(m => m.Update(It.IsAny <Indicator>()));
            mock.Setup(m => m.Save());
            IndicatorLogic indicatorLogic = new IndicatorLogic(mock.Object);

            indicatorLogic.Update(indicator);

            mock.VerifyAll();
        }
Beispiel #3
0
        public void UpdateIndicatorStringValeExpresionEqualOk()
        {
            Guid   id    = Guid.NewGuid();
            string color = "red";
            Value  izq   = new StringValue {
                Data = "hola"
            };
            Value der = new StringValue {
                Data = "chau"
            };
            BaseCondition component = new Condition
            {
                ValueIzq = izq,
                ValueDer = der,
                Operator = "="
            };
            Indicator indicator = new Indicator {
                Color     = color,
                Id        = id,
                Condition = component
            };
            var context = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            IRepository <Indicator> indicatorRepo  = new IndicatorRepository(context);
            IndicatorLogic          indicatroLogic = new IndicatorLogic(indicatorRepo);

            indicatroLogic.Create(indicator);

            Value izq1 = new StringValue {
                Data = "hola"
            };
            Value der1 = new StringValue {
                Data = "hola"
            };
            BaseCondition component2 = new Condition
            {
                ValueIzq = izq1,
                ValueDer = der1,
                Operator = "="
            };

            indicator.Condition = component2;
            indicatroLogic.Update(indicator);
            var  indicators = indicatorRepo.GetAll().ToList();
            bool res        = indicators[0].Condition.Eval();

            Assert.IsTrue(res == true);
        }