public void SetUp() { directoryReaderMock = mockRepository.CreateMock <IUserDirectoryReader>(); smtpAdapterMock = mockRepository.CreateMock <ISmtpAdapter>();; v1Instance = new V1Instance(servicesMock, metaModelMock, "Role:4"); managerMock = new Manager(v1Instance, smtpAdapterMock, directoryReaderMock); }
internal IFilterTerm BuildFilter(IAssetType assetType, V1Instance instance) { var builder = new FilterBuilder(assetType, instance); InternalModifyFilter(builder); InternalModifyState(builder); return(builder.Root.HasTerms ? builder.Root : null); }
private void TestPersonal(string publicId, string personalId, V1Instance instance, bool hasPersonal) { Note pub = instance.Get.NoteByID(publicId); Note personal = instance.Get.NoteByID(personalId); ICollection <Note> notes = instance.Get.MemberByUserName(MyUsername).GetNotes(null); Assert.IsTrue(notes.Contains(pub)); Assert.IsFalse(hasPersonal ^ notes.Contains(personal)); }
private static Manager CreateManager() { V1Instance v1 = Factory.GetV1Instance(); SmtpAdapter smtpAdapter = Factory.GetSmtpAdaptor(); IUserDirectoryReader ldapReader = new LDAPReader(); ldapReader.Initialize(ConfigurationManager.AppSettings); return(new Manager(v1, smtpAdapter, ldapReader)); }
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); }
/// <summary> /// Connect to the VersionOne server specified in the configuration file /// </summary> private void V1Connect() { _v1Url = ConfigurationManager.AppSettings["V1Server"]; string user = ConfigurationManager.AppSettings["V1User"]; string password = ConfigurationManager.AppSettings["V1Password"]; Console.WriteLine("Connecting to " + _v1Url + " as " + user); _v1Server = new V1Instance(_v1Url, user, password); }
public void SetUp() { V1Instance v1 = Factory.GetV1Instance(); testUserFactory = new TestUserFactory(v1); IUserDirectoryReader ldapReader = new DirectoryReaderStub(); ISmtpAdapter smtpAdapter = new SmtpAdapterStub(); manager = new Manager(v1, smtpAdapter, ldapReader); }
public void QueryProjects() { var proxySettings = new ProxySettings(new Uri(ProxyPath), ProxyUsername, ProxyPassword); var proxiedInstance = new V1Instance(V1Path, V1Username, V1Password, false, proxySettings); var instance = new V1Instance(V1Path, V1Username, V1Password, false); var projects = instance.Get.Projects(null); var projectsOverProxy = proxiedInstance.Get.Projects(null); Assert.AreEqual(projects.Count, projectsOverProxy.Count); }
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); }
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(); }
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."); } } }
public void TestUseIntegratedAuth() { ConfigurationManager.AppSettings.Set("IntegratedAuth", "true"); ConfigurationManager.AppSettings.Set("V1InstanceUsername", ""); ConfigurationManager.AppSettings.Set("V1InstancePassword", ""); string instanceLocation = ConfigurationManager.AppSettings.Get("V1InstanceIntegratedAuth"); ConfigurationManager.AppSettings.Set("V1Instance", instanceLocation); V1Instance v1Authorized = Factory.GetV1Instance(); IUserDirectoryReader ldapReader = new DirectoryReaderStub(); ISmtpAdapter smtpAdapter = new SmtpAdapterStub(); Manager authorizedManager = new Manager(v1Authorized, smtpAdapter, ldapReader); Assert.IsNotNull(authorizedManager); IDictionary <string, User> users = authorizedManager.GetVersionOneUsers(); Assert.Greater(users.Count, 0); }
public void ChildrenSorting() { var projects = dataLayer.GetProjectTree(); var testProject = FindTestProject(projects[0], TestProjectName); var omProject = GetOmProject(TestProjectName, testProject.Id); dataLayer.CurrentProject = testProject; var v1Instance = new V1Instance(V1Url, Username, Password, false); Story story = null; try { story = CreateStory(v1Instance, "New Story with ordered children", omProject, iteration, v1Instance.LoggedInMember); var firstTask = story.CreateTask("Task1"); var secondTask = story.CreateTask("Task2"); var thirdTask = story.CreateTask("Task3"); RankAboveAll(thirdTask, firstTask); RankAboveAll(secondTask, firstTask, thirdTask); dataLayer.Connect(GetSettings()); var cache = dataLayer.CreateAssetCache(); dataLayer.GetWorkitems(cache); var primaryWorkitems = cache.GetWorkitems(dataLayer.ShowAllTasks); var foundStory = primaryWorkitems.FirstOrDefault(workitem => workitem.GetProperty(Entity.NameProperty).Equals(story.Name) && workitem.GetProperty("Number").Equals(story.DisplayID)); Assert.IsNotNull(foundStory); AssertWorkitemMatch(foundStory.Children[0], secondTask.Name, Entity.TaskType); AssertWorkitemMatch(foundStory.Children[1], thirdTask.Name, Entity.TaskType); AssertWorkitemMatch(foundStory.Children[2], firstTask.Name, Entity.TaskType); } finally { if (story != null) { story.Delete(); } } }
public void Before() { ServiceLocator.Instance.SetContainer(new StandardKernel()); ServiceLocator.Instance.Container.Bind <IDataLayer>().ToConstant(dataLayer); ServiceLocator.Instance.Container.Bind <IDataLayerInternal>().ToConstant(dataLayer); instance = new V1Instance(V1Url, Username, Password, false); dataLayer.AddProperty("Name", Entity.StoryType, false); dataLayer.AddProperty("Name", Entity.ProjectType, false); dataLayer.AddProperty("BuildProjects", Entity.ProjectType, true); dataLayer.AddProperty("BuildProjects", Entity.ProjectType, false); dataLayer.AddProperty(Entity.ScheduleNameProperty, Entity.ProjectType, false); dataLayer.AddProperty("Owners", Entity.StoryType, false); dataLayer.AddProperty("Owners", Entity.TaskType, false); dataLayer.AddProperty("Owners", Entity.TestType, false); dataLayer.AddProperty("Owners", Entity.DefectType, false); dataLayer.AddProperty("Name", Entity.DefectType, false); dataLayer.AddProperty("Owners", Entity.StoryType, true); dataLayer.AddProperty("Owners.Nickname", Entity.StoryType, false); dataLayer.AddProperty(Entity.DoneProperty, Entity.StoryType, false); dataLayer.AddProperty(Entity.DoneProperty, Entity.TaskType, false); dataLayer.AddProperty(Entity.StatusProperty, Entity.StoryType, false); dataLayer.AddProperty(Entity.StatusProperty, Entity.StoryType, true); dataLayer.AddProperty(Entity.OrderProperty, Entity.StoryType, false); dataLayer.AddProperty(Entity.OrderProperty, Entity.TaskType, false); dataLayer.AddProperty(Entity.OrderProperty, Entity.TestType, false); dataLayer.AddProperty(Entity.OrderProperty, Entity.DefectType, false); dataLayer.AddProperty("Number", Entity.StoryType, false); dataLayer.AddProperty("Number", Entity.TaskType, false); dataLayer.AddProperty("Number", Entity.TestType, false); dataLayer.AddProperty("Number", Entity.DefectType, false); Assert.IsTrue(dataLayer.Connect(GetSettings()), "Connection validation"); dataLayer.ShowAllTasks = true; CreateTestData(); }
internal RequestPriority(V1Instance instance) : base(instance) {}
internal AttachmentType(AssetID id, V1Instance instance) : base(id, instance) { }
internal TestSet(V1Instance instance) : base(instance) { }
internal EpicType(V1Instance instance) : base(instance) { }
static void Configuration_OnChanged(object sender, EventArgs e) { _instance = null; }
internal TestSet(AssetID assetId, V1Instance instance) : base(assetId, instance) { }
internal BuildSource(AssetID id, V1Instance instance) : base(id, instance) { }
internal ThemeStatus(AssetID id, V1Instance instance) : base(id, instance) { }
internal TaskType(AssetID id, V1Instance instance) : base(id, instance) { }
internal BuildStatus(AssetID id, V1Instance instance) : base(id, instance) { }
internal WorkitemSource(AssetID id, V1Instance instance) : base(id, instance) {}
internal EpicPriority(V1Instance instance) : base(instance) { }
internal TestStatus(V1Instance instance) : base(instance) { }
internal DefectType(AssetID id, V1Instance instance) : base(id, instance) {}
internal ThemeType(V1Instance instance) : base(instance) { }
internal ProjectAsset(V1Instance instance) : base(instance) {}
internal ThemeStatus(V1Instance instance) : base(instance) { }
internal SecondaryWorkitem(AssetID id, V1Instance instance) : base(id, instance) { }
internal ListValue(AssetID id, V1Instance instance) : base(id, instance) {}
public void SetUp() { directoryReaderMock = mockRepository.CreateMock<IUserDirectoryReader>(); smtpAdapterMock = mockRepository.CreateMock<ISmtpAdapter>();; v1Instance = new V1Instance(servicesMock, metaModelMock, "Role:4"); managerMock = new Manager(v1Instance, smtpAdapterMock, directoryReaderMock); }
internal TaskType(V1Instance instance) : base(instance) { }
internal ListValue(V1Instance instance) : base(instance) {}
internal WorkitemSource(V1Instance instance) : base(instance) {}
internal Rank(V1Instance instance, Entity asset, string rankAttribute) { this.instance = instance; this.asset = asset; this.rankAttribute = rankAttribute; }
public FilterBuilder(IAssetType assetType, V1Instance instance) { this.assetType = assetType; Instance = instance; }
internal BuildStatus(V1Instance instance) : base(instance) { }
internal TestType(V1Instance instance) : base(instance) { }
internal BuildSource(V1Instance instance) : base(instance) { }
internal NoteType(AssetID id, V1Instance instance) : base(id, instance) { }
internal DefectType(V1Instance instance) : base(instance) {}
internal NoteType(V1Instance instance) : base(instance) { }
internal ProjectAsset(AssetID id, V1Instance instance) : base(id, instance) {}
internal WorkitemStatus(AssetID id, V1Instance instance) : base(id, instance) {}
internal SecondaryWorkitem(V1Instance instance) : base(instance) { }
internal WorkitemStatus(V1Instance instance) : base(instance) {}
internal EpicType(AssetID id, V1Instance instance) : base(id, instance) {}
internal GoalPriority(AssetID id, V1Instance instance) : base(id, instance) {}
internal RequestPriority(AssetID id, V1Instance instance) : base(id, instance) {}
internal GoalPriority(V1Instance instance) : base(instance) {}
public TestUserFactory(V1Instance v1) { services = v1.Services; model = v1.Model; }
internal AttachmentType(V1Instance instance) : base(instance) { }