public EntityCollection(V1Instance instance, Entity entity, string readAttributeName, string writeAttributeName)
 {
     this.instance           = instance;
     this.entity             = entity;
     this.readAttributeName  = readAttributeName;
     this.writeAttributeName = writeAttributeName;
 }
 private V1Instance Connect()
 {
     Console.WriteLine("Connecting to {0} ...", _options.Url);
     V1Instance v1Instance = new V1Instance(_options.Url, _options.Username, _options.Password);
     Console.WriteLine("Connected.");
     return v1Instance;
 }
 public void TestHasChangedSinceWithAChange()
 {
     // Given a connection to an instance of VersionOne at https://www14.v1host.com/v1sdktesting/ with user credentials for admin
     var instance = new V1Instance("https://www14.v1host.com/v1sdktesting/", "admin", "admin");
     // And a new schedule with 7 day length and no gap
     var schedule = instance.Create.Schedule(Name("Schedule"), Duration.Parse(@"7 Days"), Duration.Parse(@"0 Days"));
     // And a new parent project called "Target Project 1" under the root with that schedule
     var rootProject = instance.Get.ProjectByID(AssetID.FromToken("Scope:0"));
     var targetProject = instance.Create.Project(Name("Target Project"), rootProject, DateTime.Now, schedule);
     // And a defect under "Target Project"
     var newDefect = instance.Create.Defect(Name("New Defect"), targetProject);
     // And a new project helper
     var v1System = new SystemAllProjects(instance.ApiClient.Services, instance.ApiClient.MetaModel);
     // And the list of all projects
     var projectList = v1System.GetProjects();
     // And a new defect monitor
     var monitor = new DefectMonitor(instance.ApiClient.Services, instance.ApiClient.MetaModel);
     // And the parent project is registered with the monitor
     monitor.MonitoredProjects.Add(projectList[targetProject.ID.Token]);
     // And the most recent change date is for the defect
     var lastChange = monitor.GetMostRecentChangeDateTime();
     // When I create a new defect
     var newerDefect = instance.Create.Defect(Name("Newer Defect"), targetProject);
     // And check whether the system has changed since the remembered change date
     var actual = monitor.HasChangedSince(lastChange);
     // Then the monitor tells me there is a change
     Assert.IsTrue(actual);
 }
 private static Story CreateStoryWithEpic(V1Instance v1, Project project)
 {
     var newEpic = v1.Create.Epic(GetName("Epic"), project);
     var attributes = new Dictionary<string, object> {{"Super", newEpic.ID.Token}};
     var newStory = v1.Create.Story(GetName("Story"), project, attributes);
     return newStory;
 }
 public void TestGetProjectWhereParentAndGrandchildAreInverted()
 {
     // Given a connection to an instance of VersionOne at https://www14.v1host.com/v1sdktesting/ with user credentials for admin
     var instance = new V1Instance("https://www14.v1host.com/v1sdktesting/", "admin", "admin");
     // And a new schedule with 7 day length and no gap
     var schedule = instance.Create.Schedule(Name("Schedule"), Duration.Parse(@"7 Days"), Duration.Parse(@"0 Days"));
     // And a new parent project under the root with that schedule
     var rootProject = instance.Get.ProjectByID(AssetID.FromToken("Scope:0"));
     var parentProject = instance.Create.Project(Name("Parent Project"), rootProject, DateTime.Now, schedule);
     // And a new child project under the parent with the same schedule
     var childProject = instance.Create.Project(Name("Child Project"), parentProject, DateTime.Now, schedule);
     // And a new grandchild project under the root
     var grandChildProject = instance.Create.Project(Name("Grandchild Project"), rootProject, DateTime.Now, schedule);
     // And move the Parent into the Grandchild
     parentProject.ParentProject = grandChildProject;
     parentProject.Save();
     // And a new helper
     var v1System = new SystemAllProjects(instance.ApiClient.Services, instance.ApiClient.MetaModel);
     // And the list of all projects
     var projectList = v1System.GetProjects();
     // When I ask for the project path for the child project
     var actual = projectList[childProject.ID.Token].PathName;
     // Then I get a concatenation of the root project, the parent project, and the child project, in that order
     var expected = rootProject.Name + "\\" + grandChildProject.Name + "\\" + parentProject.Name + "\\" + childProject.Name;
     Assert.AreEqual(expected, actual);
 }
        private static Task CreateTask(V1Instance instance, string name, PrimaryWorkitem parent, Member owner) {
            var task = instance.Create.Task(name, parent);

            task.Owners.Add(owner);
            task.Save();

            return task;
        }
 public void AddToDefectFilter(V1Instance v1Instance, DefectFilter filter, bool includeDecendants)
 {
     var projectList = includeDecendants ? ChildrenMeAndDown : JustMe;
     foreach (var project in projectList)
     {
         filter.Project.Add(v1Instance.Get.ProjectByID(project.ScopeId));
     }
 }
 public void TestCalcPrimaryWorkitemsWeights()
 {
     const string url = "https://www14.v1host.com/v1sdktesting/";
     const string username = "******";
     const string password = "******";
     var v1 = new V1Instance(url, username, password);
     var project = v1.Get.ProjectByID("Scope:0");
     var newStory = CreateStoryWithEpic(v1, project);
     var primaryWorkitems = new List<PrimaryWorkitem>(GetFilteredPrimaryWorkitemsForProject(project));
     CollectionAssert.DoesNotContain(primaryWorkitems, newStory);
 }
        private static Story CreateStory(V1Instance instance, string name, OmProject project, Iteration iteration, Member owner) {
            var story = instance.Create.Story(name, project);

            if(owner != null) {
                story.Owners.Add(owner);
            }

            story.Iteration = iteration;
            story.Save();

            return story;
        }
Beispiel #10
0
        public V1MessageStore(V1Instance v1In)
        {
            try
            {
                _v1In = v1In;
                messageFilter = new MessageFilter();
                messageFilter.Recipient.Add(_v1In.LoggedInMember);
            }
            catch(Exception ex)
            {

            }
        }
        public static void Main(string[] args)
        {
            const string hostname = "https://www14.v1host.com/"; // Must be https:// if the remote host is on HTTPS!
            const string instanceName = "v1sdktesting/";
            const string url = hostname + instanceName;

            const string username = "******";
            const string password = "******";

            var instance = new V1Instance(url, username, password);

            const string projectName = "Console App Project";
            var project = instance.Get.ProjectByName(projectName);

            if (project == null)
            {
                throw new Exception(
                    "Please contact the VersionOne SDK developers and tell them to fix their example database!");
            }

            var yourName = System.Environment.UserName;
            var storyName = string.Format("{0}'s story at {1}", yourName, 
                DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString());
            var attributes = new Dictionary<string, object>
                {
                    {
                        "Description",
                        string.Format("{0} is adding this story from the console app...", yourName)
                    }
                };

            var story = instance.Create.Story(storyName, project, attributes);
            story.Save();

            var v1StoryId = story.ID.Token;

            Console.WriteLine("Created story with id {0}, name {1}, and description '{2}' in project named {3}",
                              v1StoryId,
                              story.Name,
                              story.Description,
                              story.Project.Name);
            Console.WriteLine();
            Console.WriteLine("Browse to this story on the web at:");
            Console.WriteLine(story.URL);
            Console.WriteLine();
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
Beispiel #12
0
        static void Main(string[] args)
        {
            var instance = new V1Instance("http://localhost/versionone.web/", "admin", "admin");
            var project = instance.Get.ProjectByName("System (All Projects)");
            var maxMegs = 4;
            var generator = new RandomBufferGenerator(4.Megabytes());
            var testName = DateTime.Now.ToString("d");

            try
            {
                for (int megs = 1; megs <= maxMegs; megs++)
                {
                    var currentCount = 0;
                    var maxCount = 1.Thousand();
                    var nextPercent = 10;

                    Console.WriteLine("Started creating {0} defects with {1}MB attachments at {2}", maxCount, megs, DateTime.Now);

                    while (currentCount++ < maxCount)
                    {
                        Func<string,string> assetName = (asset) => string.Format("Load Test ({0}) {3} - {1}/{2}", testName, currentCount, maxCount, asset);

                        var defect = instance.Create.Defect(assetName("Defect"), project);

                        var attachmentStream = new MemoryStream(generator.GenerateBufferFromSeed(megs.Megabytes()));
                        var attachment = defect.CreateAttachment(assetName(megs + "MB Attachment"), "Filename", attachmentStream);
                        var link = defect.CreateLink(assetName("Link"), "http://google.com", false);

                        if ((float)currentCount/maxCount*100 >= nextPercent)
                        {
                            Console.WriteLine("{0}% Complete", nextPercent);
                            nextPercent += 10;
                        }
                    }

                    Console.WriteLine("Finished creating {0} defects at {1}", currentCount - 1, DateTime.Now);
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            Console.WriteLine("All done");
            Console.ReadKey();
        }
Beispiel #13
0
        static void Main(string[] args)
        {
            var v1 = new V1Instance(Url, Username, Password);

            foreach (var row in MyExcelDataSource.GetMyExcelData())
            {
                var whereTerm = new KeyValuePair<string, string>("Number", row.StoryNumber);
                var whichStories = new StoryFilter();
                whichStories.ArbitraryWhereTerms.Add(whereTerm);
                foreach (var story in v1.Get.Stories(whichStories).Take(1))
                {
                    Console.WriteLine("Got story {0}, updating...", story);
                    story.Estimate = row.NewEstimate;
                    story.Save("Updated from excel sheet on " + DateTimeOffset.Now);
                    Console.WriteLine("Story updated.");
                }
            }
        }
 internal Member(AssetID id, V1Instance instance) : base(id, instance) {}
 internal Environment(V1Instance instance) : base(instance)
 {
 }
 internal RegressionTest(AssetID assetID, V1Instance instance) : base(assetID, instance)
 {
 }
 internal Story(AssetID id, V1Instance instance) : base(id, instance) {
 }
Beispiel #18
0
 internal Retrospective(V1Instance instance) : base(instance)
 {
 }
 internal Theme(AssetID id, V1Instance instance) : base(id, instance) {
 }
 internal StoryTemplate(AssetID id, V1Instance instance) : base(id, instance)
 {
 }
Beispiel #21
0
 internal Team(AssetID id, V1Instance instance) : base(id, instance)
 {
 }
 internal Environment(AssetID assetId, V1Instance instance) : base(assetId, instance)
 {
 }
Beispiel #23
0
 internal RegressionSuite(V1Instance instance) : base(instance)
 {
 }
 internal Expression(AssetID id, V1Instance instance) : base(id, instance)
 {
 }
 internal Expression(V1Instance instance) : base(instance)
 {
 }
Beispiel #26
0
 internal Iteration(V1Instance instance) : base(instance)
 {
     SetRelation("State", State.Future);
 }
Beispiel #27
0
 internal Iteration(AssetID id, V1Instance instance) : base(id, instance)
 {
 }
Beispiel #28
0
 internal RegressionSuite(AssetID assetId, V1Instance instance) : base(assetId, instance)
 {
 }
 internal Epic(AssetID id, V1Instance instance) : base(id, instance) {}
 internal Note(V1Instance instance) : base(instance)
 {
 }
	    internal Schedule(AssetID id, V1Instance instance) : base(id, instance) { }
 internal Note(AssetID id, V1Instance instance) : base(id, instance)
 {
 }
Beispiel #33
0
 internal Retrospective(AssetID id, V1Instance instance) : base(id, instance)
 {
 }
 internal Note(Note responseTo, V1Instance instance) : base(instance)
 {
     SetRelation("InResponseTo", responseTo);
 }
 internal Theme(V1Instance instance) : base(instance) {
 }
Beispiel #36
0
 internal Story(V1Instance instance) : base(instance)
 {
 }
 internal RegressionTest(V1Instance instance) : base(instance)
 {
 }
Beispiel #38
0
 internal Story(AssetID id, V1Instance instance) : base(id, instance)
 {
 }
 internal Story(V1Instance instance) : base(instance) {
 }
 internal Attachment(V1Instance instance) : base(instance)
 {
     Set("Content", string.Empty);
 }
 internal Attachment(AssetID id, V1Instance instance) : base(id, instance)
 {
 }
		internal TestSuite(AssetID id, V1Instance instance) : base(id, instance) { }
 internal Member(V1Instance instance) : base(instance) {}
 internal BaseAsset(AssetID id, V1Instance instance) : base(id, instance) {}
		internal TestSuite(V1Instance instance) : base(instance) {}
 internal ChangeSet(V1Instance instance) : base(instance)
 {
 }
 internal BaseAsset(V1Instance instance) : base(instance) {}
Beispiel #48
0
 internal BaseAsset(AssetID id, V1Instance instance) : base(id, instance)
 {
 }
 internal Epic(V1Instance instance) : base(instance) {}
 internal RegressionSuite(AssetID assetId, V1Instance instance) : base(assetId, instance) {}
 internal StoryTemplate(V1Instance instance) : base(instance)
 {
 }
		internal Request(V1Instance instance) : base(instance) { }
	    internal Schedule(V1Instance instance) : base(instance) { }
		internal Request(AssetID id, V1Instance instance) : base(id, instance) { }
Beispiel #55
0
 internal BaseAsset(V1Instance instance) : base(instance)
 {
 }
Beispiel #56
0
 internal Team(V1Instance instance) : base(instance)
 {
 }
 internal RegressionSuite(V1Instance instance) : base(instance) {}
 internal Project(AssetID id, V1Instance instance) : base(id, instance)
 {
 }
Beispiel #59
0
 internal GetMethods(V1Instance instance)
 {
     this.instance = instance;
 }
 internal Project(V1Instance instance) : base(instance)
 {
 }