public void ShouldCreateSystemEventApi()
        {
            // Arrange
            HttpHeaders     headers = new HttpHeaders();
            IServiceFactory factory = new ServiceFactory(Mock.Of <IHttpAddress>(), Mock.Of <IHttpFacade>(), Mock.Of <IContentSerializer>(), headers);

            // Act
            ISystemEventApi api = factory.CreateSystemEventApi();

            // Assert
            api.ShouldNotBe(null);
        }
Пример #2
0
        public async Task RunAsync(IRestContext context)
        {
            ISystemEventApi eventApi = context.Factory.CreateSystemEventApi();

            IEnumerable <string> events = (await eventApi.GetEventsAsync()).ToList();

            Console.WriteLine("GetEventsAsync(): Found {0} events", events.Count());

            string eventName = events.First();

            // create
            EventScriptRequest  createRequest  = CreateEventScript();
            EventScriptResponse createResponse = await eventApi.CreateEventScriptAsync(eventName, new SqlQuery(), createRequest);

            Console.WriteLine("CreateEventScriptAsync(): Created script {0}", createResponse.Name);

            // delete
            EventScriptResponse deleteResponse = await eventApi.DeleteEventScriptAsync(eventName, new SqlQuery());

            Console.WriteLine("DeleteEventScriptAsync(): Deleted script {0}", deleteResponse.Name);
        }