Пример #1
0
        public void Initialize_ShouldReturnInternalError_When_CalledWithConfig_And_ConfigIsSet()
        {
            var graph  = new CalculatorGraph(validConfigText);
            var status = graph.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(validConfigText));

            Assert.AreEqual(status.code, Status.StatusCode.Internal);
        }
Пример #2
0
        public void Initialize_ShouldReturnOk_When_CalledWithConfig_And_ConfigIsNotSet()
        {
            var graph  = new CalculatorGraph();
            var config = CalculatorGraphConfig.ParseFromString(validConfigText);
            var status = graph.Initialize(config);

            Assert.True(status.ok);
            Assert.Greater(graph.config.byteSizeLong, 0);
        }
Пример #3
0
 public void Initialize_ShouldReturnInternalError_When_CalledWithConfig_And_ConfigIsSet()
 {
     using (var graph = new CalculatorGraph(_ValidConfigText))
     {
         using (var status = graph.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_ValidConfigText)))
         {
             Assert.AreEqual(Status.StatusCode.Internal, status.Code());
         }
     }
 }
Пример #4
0
        public void Initialize_ShouldReturnInternalError_When_CalledWithConfigAndSidePacket_And_ConfigIsSet()
        {
            var graph      = new CalculatorGraph(validConfigText);
            var config     = CalculatorGraphConfig.Parser.ParseFromTextFormat(validConfigText);
            var sidePacket = new SidePacket();

            sidePacket.Emplace("flag", new BoolPacket(true));
            var status = graph.Initialize(config, sidePacket);

            Assert.AreEqual(status.code, Status.StatusCode.Internal);
        }
Пример #5
0
        public void Initialize_ShouldReturnOk_When_CalledWithConfigAndSidePacket_And_ConfigIsNotSet()
        {
            var graph      = new CalculatorGraph();
            var config     = CalculatorGraphConfig.Parser.ParseFromTextFormat(validConfigText);
            var sidePacket = new SidePacket();

            sidePacket.Emplace("flag", new BoolPacket(true));
            var status = graph.Initialize(config, sidePacket);

            Assert.True(status.ok);
        }
Пример #6
0
        public void Initialize_ShouldReturnOk_When_CalledWithConfig_And_ConfigIsNotSet()
        {
            var graph  = new CalculatorGraph();
            var status = graph.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(validConfigText));

            Assert.True(status.ok);

            var config = graph.Config();

            Assert.AreEqual(config.InputStream[0], "in");
            Assert.AreEqual(config.OutputStream[0], "out");
        }
Пример #7
0
        public void Initialize_ShouldReturnOk_When_CalledWithConfig_And_ConfigIsNotSet()
        {
            using (var graph = new CalculatorGraph())
            {
                using (var status = graph.Initialize(CalculatorGraphConfig.Parser.ParseFromTextFormat(_ValidConfigText)))
                {
                    Assert.True(status.Ok());
                }

                var config = graph.Config();
                Assert.AreEqual("in", config.InputStream[0]);
                Assert.AreEqual("out", config.OutputStream[0]);
            }
        }