Ejemplo n.º 1
0
        public void GetClassInstanceManyParametersObjectOrderDifferentTest()
        {
            var config = new PromptConfiguration(); // Scan this file only
            var data2A = new Data2a();
            var data2B = new Data2b();

            config.Objects = new object[] { data2B, data2A };
            var prompt = new Prompt(config);

            prompt.Run("2aCmd1");
            data2A.Name.Should().Be("2aCmd1");
        }
Ejemplo n.º 2
0
        public void GetClassInstanceKeptIsTest()
        {
            var config = new PromptConfiguration(); // Scan this file only
            var data2B = new Data2b();

            config.Objects = new object[] { data2B };
            var prompt = new Prompt(config);

            prompt.Run("2bCmd1");  // 2b New Class Instance between Commands
            data2B.Name.Should().Be("2bCmd1");
            data2B.ClassCount.Should().Be(1);
            data2B.UsageCount.Should().Be(1);

            prompt.Run("2bCmd1");
            data2B.ClassCount.Should().Be(1); // Keep Class Reused between Commands, that same count
            data2B.UsageCount.Should().Be(2);
        }
Ejemplo n.º 3
0
 public Class2BWithObjectClass(Data2b dataObject)
 {
     DataObject            = dataObject;
     dataObject.Name       = "WithClass2";
     dataObject.ClassCount = ++ClassCount;
 }