Beispiel #1
0
        private void GivenServerTime(DateTime dateTime)
        {
            var json = new ServiceTimeResponse {
                DateTimeUtc = dateTime
            }.ToJson();

            Mocker.GetMock <IHttpClient>()
            .Setup(s => s.Execute(It.IsAny <HttpRequest>()))
            .Returns <HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Encoding.ASCII.GetBytes(json)));
        }
        private void GivenServerTime(DateTime dateTime)
        {
            var json = new ServiceTimeResponse {
                DateTimeUtc = dateTime
            }.ToJson();

            Mocker.GetMock <ILocalizationService>()
            .Setup(s => s.GetLocalizedString(It.IsAny <string>()))
            .Returns("System time is off by more than 1 day. Scheduled tasks may not run correctly until the time is corrected");

            Mocker.GetMock <IHttpClient>()
            .Setup(s => s.Execute(It.IsAny <HttpRequest>()))
            .Returns <HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new CookieCollection(), Encoding.ASCII.GetBytes(json)));
        }