public void SetUp()
 {
     TestTargetMock = new Mock<ITestTarget>();
     TestTarget = new MyTestTarget { Mock = TestTargetMock };
     SessionIdProviderMock = new Mock<ISessionIdProvider>();
     SessionIdProviderMock.Setup(s => s.SessionId).Returns("TestSessionId");
 }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// </param>
 /// <param name='timeStamp'>
 /// </param>
 /// <param name='x'>
 /// </param>
 /// <param name='y'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <string> ReportTouchAsync(this ITestTarget operations, long id, string timeStamp, double x, double y, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ReportTouchWithHttpMessagesAsync(id, timeStamp, x, y, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 protected override void OnSetUp()
 {
     base.OnSetUp();
     TestTargetMock = new Mock<ITestTarget>();
     TestTargetMock.Setup(t => t.TestMethod(It.IsAny<int>())).Returns("TestResult");
     TestTarget = applicationContext.ConfigureObject<ITestTarget>(TestTargetMock.Object);
 }
Exemple #4
0
        public void IntegrationTest()
        {
            ProxyFactory pf = new ProxyFactory(new TestTarget());

            ILog log = A.Fake <ILog>();
            SimpleLoggingAdvice loggingAdvice = new SimpleLoggingAdvice(log);

            pf.AddAdvice(loggingAdvice);

            A.CallTo(() => log.IsTraceEnabled).Returns(true);

            object      proxy = pf.GetProxy();
            ITestTarget ptt   = (ITestTarget)proxy;

            ptt.DoSomething();

            A.CallTo(() => log.Trace("Entering DoSomething")).MustHaveHappened();
            A.CallTo(() => log.Trace("Exiting DoSomething")).MustHaveHappened();
        }
        public void IntegrationTest()
        {
            ProxyFactory pf = new ProxyFactory(new TestTarget());

            ILog log = (ILog)mocks.CreateMock(typeof(ILog));
            SimpleLoggingAdvice loggingAdvice = new SimpleLoggingAdvice(log);

            pf.AddAdvice(loggingAdvice);

            Expect.Call(log.IsTraceEnabled).Return(true).Repeat.Any();
            log.Trace("Entering DoSomething");
            log.Trace("Exiting DoSomething");

            mocks.ReplayAll();

            object      proxy = pf.GetProxy();
            ITestTarget ptt   = (ITestTarget)proxy;

            ptt.DoSomething();

            mocks.VerifyAll();
        }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// </param>
 /// <param name='timeStamp'>
 /// </param>
 /// <param name='x'>
 /// </param>
 /// <param name='y'>
 /// </param>
 public static string ReportTouch(this ITestTarget operations, long id, string timeStamp, double x, double y)
 {
     return(Task.Factory.StartNew(s => ((ITestTarget)s).ReportTouchAsync(id, timeStamp, x, y), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 public CustomVisionTester(ILogger logger,
                           ITestTarget target)
 {
     this.logger = logger;
     this.target = target;
 }