コード例 #1
0
        public void ProjectIdIdentity()
        {
            ProjectData data = new ProjectData(
                "New Project",
                "Default",
                "None",
                "None");

            int id = database.AddProject(data);
            Assert.AreEqual(1, id);

            id = database.AddProject(data);
            Assert.AreEqual(2, id);

            id = database.AddProject(data);
            Assert.AreEqual(3, id);

            database.RemoveProject(2);

            id = database.AddProject(data);
            Assert.AreEqual(4, id);

            database.RemoveProject(3);
            database.RemoveProject(4);

            id = database.AddProject(data);
            Assert.AreEqual(2, id);
        }
コード例 #2
0
ファイル: ProjectRow.cs プロジェクト: katerina-marchenkova/my
        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectRow"/> class.
        /// </summary>
        public ProjectRow(int id, ProjectData data)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            this.id = id;
            this.data = data;
        }
コード例 #3
0
        public void ProjectOperations()
        {
            ProjectData data = new ProjectData(
                "New Project",
                "Default",
                "GIT",
                "None");
            int id = database.AddProject(data);

            ProjectRow project = database.GetProject(id);
            Assert.AreEqual(id, project.Id);
            Assert.AreEqual("New Project", project.Data.ProjectName);
            Assert.AreEqual("Default", project.Data.ImageCode);
            Assert.AreEqual("GIT", project.Data.StorageCode);
            Assert.AreEqual("None", project.Data.StoragePath);

            data = new ProjectData(
                "Updated Project",
                "Photo",
                "SourceSafe",
                "Path");
            database.UpdateProject(id, data);

            project = database.GetProject(id);
            Assert.AreEqual(id, project.Id);
            Assert.AreEqual("Updated Project", project.Data.ProjectName);
            Assert.AreEqual("Photo", project.Data.ImageCode);
            Assert.AreEqual("SourceSafe", project.Data.StorageCode);
            Assert.AreEqual("Path", project.Data.StoragePath);

            database.RemoveProject(id);

            project = database.GetProject(id);
            Assert.IsNull(project);

            database.RemoveProject(id);
            database.RemoveProject(Int32.MaxValue);
        }