Пример #1
0
    // Use this for initialization
    void Start()
    {
        ITestLogic lo  = InvokeService.Proxy <ITestLogic>();
        string     res = lo.test();

        print(res);
        //bool isAss = typeof(IHttpSync).IsAssignableFrom(typeof(ITesst));
        //print(typeof(ITesst));
        //print(typeof(IHttpSync));
        //print(isAss);
        //ITesst socket = InvokeService.Proxy<ITesst>();
        //socket.xxx(1, "a");、
        // HttpWebRequest wbRequest = (HttpWebRequest)WebRequest.Create("");
        //wbRequest.Method = "POST";
        //wbRequest.ContentType = "application/octet-stream";
        //using (Stream requestStream = wbRequest.GetRequestStream())
        //{
        //    using (StreamWriter sw = new StreamWriter(requestStream))
        //    {
        //        //sw.Write(null);
        //    }
        //}
        //HttpWebResponse wbResponse = (HttpWebResponse)wbRequest.GetResponse();
        //using (Stream responseStream = wbResponse.GetResponseStream())
        //{
        //    using (StreamReader sread = new StreamReader(responseStream))
        //    {
        //        result = sread.ReadToEnd();
        //    }
        //}
    }
Пример #2
0
        public void TestLogicFactory_Can_CreateTestLogicInstance()
        {
            //Arrange
            //method args = string testType
            bool   result       = false;
            string sysrTestType = "Sysr";
            string mapsTestType = "Maps";

            TestLogicFactory target = new TestLogicFactory();

            //Act
            ITestLogic testLogic1 = target.CreateTestLogicInstance(sysrTestType);
            ITestLogic testLogic2 = target.CreateTestLogicInstance(mapsTestType);

            if (testLogic1 is SysrTestLogic)
            {
                if (testLogic2 is MapsTestLogic)
                {
                    result = true;
                }
            }

            //Assert
            Assert.IsTrue(result);
        }
Пример #3
0
        public void Show(ITestLogic tl)
        {
            //TestLogic1 tl = new TestLogic1();

            while (true)
            {
                // obtain one question at a time
                Question question = tl.NextQuestion();

                // break the loop when no questions are left
                if (question == null)
                {
                    break;
                }

                // display question to the user
                Console.WriteLine($"Q: {question.Statement}");
                Console.WriteLine($"1: { question.Option1}");
                Console.WriteLine($"2: { question.Option2}");
                Console.WriteLine($"3: { question.Option3}");
                Console.WriteLine($"4: { question.Option4}");

                // Accept user's choice
                Console.Write("Select an Option: ");
                int choice = Convert.ToInt32(Console.ReadLine());

                // Get user's choice compared to correct answer and get user's marks incremented
                tl.CheckAnswer(choice);
            }

            // Display result
            Console.WriteLine($"You obtained ${ tl.UserMarks} out of ${ tl.TotalMarks}");
        }
Пример #4
0
 public Question GetNextQuestion(Test test, Question prevQuestion, ITestLogic logic)
 {
     this.logic = logic;
     int qId = logic.GetQuestionId(test, prevQuestion, uow);
     Question q = uow.Questions.GetById(qId);
     return q;
 }
Пример #5
0
        public Question GetNextQuestion(Test test, Question prevQuestion, ITestLogic logic)
        {
            this.logic = logic;
            int      qId = logic.GetQuestionId(test, prevQuestion, uow);
            Question q   = uow.Questions.GetById(qId);

            return(q);
        }
        public void Setup()
        {
            _testRepoMock    = new Mock <ITestRepository>();
            _appSettingsMock = new Mock <IOptions <AppSettings> >();
            _testLogic       = new TestLogic(_testRepoMock.Object, _appSettingsMock.Object);

            _testRepoMock.Setup(tr => tr.getValueFromTheDatabase()).Returns(5);
        }
Пример #7
0
        /// <summary></summary>
        public IntegrationApiController(IConfiguration configuration, ITestLogic testLogic)
        {
            _testLogic = testLogic;

            var platformSettings = configuration.GetSection("Platform").Get <PlatformSettings>();
            var tokenRefresher   = new TokenRefresher(configuration, platformSettings.ClientId, platformSettings.ClientSecret);

            _integrationApiClient = new IntegrationApiRestClient(new HttpSender(platformSettings.IntegrationApiUrl, tokenRefresher.GetServiceClient()));
        }
Пример #8
0
        public BusinessApiTranslationsTestController(IConfiguration configuration, ITestLogic testLogic) : base(configuration, testLogic)
        {
            var platformSettings = configuration.GetSection("Platform").Get <PlatformSettings>();

            var tokenRefresher1 = new TokenRefresher(configuration, configuration["Capability1:ClientId"], configuration["Capability1:ClientSecret"]);

            _bapiClientAsCapability1Client = new BusinessApiRestClient(new HttpSender(platformSettings.BusinessApiUrl, tokenRefresher1));

            var tokenRefresher2 = new TokenRefresher(configuration, configuration["Capability2:ClientId"], configuration["Capability2:ClientSecret"]);

            _bapiClientAsCapability2Client = new BusinessApiRestClient(new HttpSender(platformSettings.BusinessApiUrl, tokenRefresher2));
        }
Пример #9
0
        public Question GetNextQuestion(Test test, Question prevQuestion)
        {
            if (test.Type != null)
            {
                //this.tLogic = logic;
                tLogic = this.factory.CreateTestLogicInstance(test.Type);
                int      qId = tLogic.GetQuestionId(test, prevQuestion, uow);
                Question q   = uow.Questions.GetById(qId);
                return(q);
            }

            return(null);
        }
Пример #10
0
        public Question GetNextQuestion(Test test, Question prevQuestion)
        {
            if (test.Type != null)
            {
                //this.tLogic = logic;
                tLogic = this.factory.CreateTestLogicInstance(test.Type);
                int qId = tLogic.GetQuestionId(test, prevQuestion, uow);
                Question q = uow.Questions.GetById(qId);
                return q;
            }

            return null;
        }
        public Capability1CallbackController(IConfiguration configuration, ITestLogic testLogic) : base(configuration, testLogic)
        {
            var nexusSettings    = configuration.GetSection("Nexus").Get <NexusSettings>();
            var platformSettings = configuration.GetSection("Platform").Get <PlatformSettings>();
            // Note! Assumes same /Tokens endpoint in the Business API as in Nexus Fundamentals
            var authManager    = new NexusAuthenticationManager(nexusSettings.Tenant, platformSettings.IntegrationApiUrl);
            var tokenRefresher = authManager.CreateTokenRefresher(new AuthenticationCredentials {
                ClientId = platformSettings.ClientId, ClientSecret = platformSettings.ClientSecret
            });

            // Note! Assumes same /TestBench endpoint in the Business API as in Nexus Business Events
            _businessEventsClient = new BusinessEvents(platformSettings.IntegrationApiUrl, nexusSettings.Tenant, tokenRefresher.GetServiceClient());
        }
Пример #12
0
        public static void Main()
        {
            // Display UI
            //ConsoleUI cui = new ConsoleUI();
            //cui.Show();

            // GraphicalUI gui = new GraphicalUI();
            // gui.Show();

            ITestLogic tl  = Factory.GetLogic();
            IUI        cui = Factory.GetUI();

            cui.Show(tl);

            Console.ReadLine();
        }
 public ConsoleApplication(ITestLogic logic)
 {
     Logic = logic;
 }
Пример #14
0
 public TestVm(ITestLogic logic)
 {
     _logic = logic;
 }
 public TestController(ITestLogic logic)
 {
     Logic = logic;
 }
 public ConsoleApplication(ITestLogic logic)
 {
     Logic = logic;
 }
Пример #17
0
 public void Show(ITestLogic t1)
 {
     this.tl = t1;
     // Display the GUI and Start the Event Loop
     ShowDialog();
 }
        public Capability1TestsController(IConfiguration configuration, ITestLogic testLogic) : base(configuration, testLogic)
        {
            var baseUri = $"{configuration["Capability1:BaseUrl"]}";

            _restclient = new Capability1RestClient(new HttpSender(baseUri));
        }
Пример #19
0
 /// <summary></summary>
 protected TestControllerBase(IConfiguration configuration, ITestLogic testLogic)
 {
     Configuration = configuration;
     TestLogic     = testLogic;
 }
 public TestController(ITestLogic logic)
 {
     Logic = logic;
 }
Пример #21
0
 public Capability2TestsController(IConfiguration configuration, ITestLogic testLogic) : base(configuration, testLogic)
 {
 }
 public TestsController(IHubContext <TestsHub> hubContext, ITestLogic testLogic)
 {
     _hubContext = hubContext;
     _testLogic  = testLogic;
 }
 /// <summary></summary>
 public PurgeJob(ITestLogic testLogic, ILogger <PurgeJob> logger)
 {
     _testLogic = testLogic;
     _logger    = logger;
 }
 public TestController(ITestLogic testLogic)
 {
     _testLogic = testLogic;
 }
Пример #25
0
 public SandboxController(ITestLogic testLogic)
 {
     this._testLogic = testLogic;
 }
Пример #26
0
 /// <summary></summary>
 public AllTestsController(IConfiguration configuration, ITestLogic testLogic) : base(configuration, testLogic)
 {
 }
Пример #27
0
 /// <summary></summary>
 public PlatformAuthenticationTestController(IConfiguration configuration, ITestLogic testLogic) : base(configuration, testLogic)
 {
     _platformSettings = configuration.GetSection("Platform").Get <PlatformSettings>();
     _apiRestClient    = new IntegrationApiRestClient(new HttpSender(_platformSettings.IntegrationApiUrl));
 }
 public TestsHub(ITestLogic testLogic)
 {
     _testLogic = testLogic;
 }
Пример #29
0
 public QuestionGenerator(ITestLogic logic)
 {
     this.logic = logic;
 }
Пример #30
0
 public QuestionGenerator(ITestLogic logic)
 {
     this.logic = logic;
 }