Exemplo n.º 1
0
 public static void Initialize()
 {
     Database.SetInitializer(new CreateInitializer()); //if u want to use your initializer
     using (var db = new TreeTestContext())
     {
         {
             db.Database.Initialize(true);
         }
     }
 }
Exemplo n.º 2
0
        public async Task BranchWithTrueFlowTest()
        {
            // Given
            ITree <TreeTestContext> tree = new Tree <TreeTestContext>(GetBranchTest(), Producer);
            var context = new TreeTestContext(3, 1);

            // When
            await tree.Run(context);

            // Then
            Assert.AreEqual(150, context.Y);
        }
Exemplo n.º 3
0
        public async Task BranchWithFalseFlowTest()
        {
            // Given
            ITree <TreeTestContext> tree = new Tree <TreeTestContext>(GetBranchTest(), Producer);
            var context = new TreeTestContext(1, 3);

            // When
            await tree.Run(context);

            // Then
            Assert.AreEqual(99, context.Z);
        }
Exemplo n.º 4
0
        public async Task RootTest()
        {
            // Given
            ISection root = new Trunk(ScriptHelper.GetScript <TreeTestContext>("Z = X + Y"));
            ITree <TreeTestContext> tree = new Tree <TreeTestContext>(root, Producer);
            var context = new TreeTestContext(1, 3);

            // When
            await tree.Run(context);

            // Then
            Assert.AreEqual(4, context.Z);
        }
Exemplo n.º 5
0
        public async Task MultipleSequentialSegmentsTest()
        {
            // Given
            var root = new Trunk(CreateScript("Z = X + Y"));

            root.AddSection(CreateScript("Z = Z * 10")).AddSection(CreateScript("Y = Y * Y")).AddSection(CreateScript("X = -123"));
            ITree <TreeTestContext> tree = new Tree <TreeTestContext>(root, Producer);
            var context = new TreeTestContext(1, 3);

            // When
            await tree.Run(context);

            // Then
            Assert.AreEqual(-123, context.X);
            Assert.AreEqual(9, context.Y);
            Assert.AreEqual(40, context.Z);
        }
Exemplo n.º 6
0
 public Repository()
 {
     this.db = new TreeTestContext();
 }