public void AsSisUser_Append()
        {
            var asUser = new AsUser(AsUserType.SIS, "joe");
            var actual = asUser.AppendQuery(_uriWithQuery);

            Assert.AreEqual("http://example.com/?foo=bar&as_user_id=sis_user_id%3Ajoe", actual.AbsoluteUri);
        }
        public void AsCanvasUser_Append()
        {
            var asUser = new AsUser(AsUserType.Canvas, "1234");
            var actual = asUser.AppendQuery(_uriWithQuery);

            Assert.AreEqual("http://example.com/?foo=bar&as_user_id=1234", actual.AbsoluteUri);
        }
 private void AddOptions(IList <string> arguments)
 {
     arguments.AddConditionally(
         Detached != Default.Detached,
         "--detach");
     arguments.AddConditionally(
         WithExtendedPrivileges != Default.WithExtendedPrivileges,
         "--privileged");
     arguments.AddConditionally(
         !AsUser.Equals(Default.AsUser, StringComparison.OrdinalIgnoreCase),
         $"--user {AsUser}");
     arguments.AddConditionally(
         WithoutTty != Default.WithoutTty,
         "-T");
     arguments.AddConditionally(
         InServiceContainer > Default.InServiceContainer,
         $"--index {InServiceContainer}");
     arguments.AddConditionally(
         !WithinWorkingDirectory.Equals(Default.WithinWorkingDirectory),
         $"--workdir \"{WithinWorkingDirectory}\"");
     arguments.AddConditionally(
         EnvironmentVariables.Any(),
         $"{string.Join(" ", EnvironmentVariables.Select(pair => $"--env {pair.Key}=\"{pair.Value}\""))}");
 }
 public void AsSisUser_Append()
 {
     var asUser = new AsUser(AsUserType.SIS, "joe");
     var actual = asUser.AppendQuery(_uriWithQuery);
     Assert.AreEqual("http://example.com/?foo=bar&as_user_id=sis_user_id%3Ajoe", actual.AbsoluteUri);
 }
 public void AsCanvasUser_Append()
 {
     var asUser = new AsUser(AsUserType.Canvas, "1234");
     var actual = asUser.AppendQuery(_uriWithQuery);
     Assert.AreEqual("http://example.com/?foo=bar&as_user_id=1234", actual.AbsoluteUri);
 }
Beispiel #6
0
        /// <summary>
        /// Returns the list of active courses for the current user.
        /// </summary>
        public async Task <IEnumerable <Course> > GetAll(UserEnrollmentType?enrollmentType = null, UserInclude?include = null, AsUser asUser = null)
        {
            ApiRequest request = new ApiRequest(_config.CoursesEndpointUri, asUser)
                                 .Param("enrollment_type", enrollmentType)
                                 .Param("include", include);

            return(await GetReponseAsync <IEnumerable <Course> >(request).ConfigureAwait(false));
        }