Пример #1
0
        public void Should_Create_Version()
        {
            const string         NEW_VERSION_NAME        = "VersionTesting";
            const VersionStatus  NEW_VERSION_STATUS      = VersionStatus.Locked;
            const VersionSharing NEW_VERSION_SHARING     = VersionSharing.Hierarchy;
            DateTime             newVersionDueDate       = DateTime.Now.AddDays(7);
            const string         NEW_VERSION_DESCRIPTION = "Version description";

            var version = new Version
            {
                Name        = NEW_VERSION_NAME,
                Status      = NEW_VERSION_STATUS,
                Sharing     = NEW_VERSION_SHARING,
                DueDate     = newVersionDueDate,
                Description = NEW_VERSION_DESCRIPTION
            };

            var savedVersion = fixture.RedmineManager.CreateObject(version, PROJECT_ID);

            Assert.NotNull(savedVersion);
            Assert.NotNull(savedVersion.Project);
            Assert.True(savedVersion.Name.Equals(NEW_VERSION_NAME), "Version name is invalid.");
            Assert.True(savedVersion.Status.Equals(NEW_VERSION_STATUS), "Version status is invalid.");
            Assert.True(savedVersion.Sharing.Equals(NEW_VERSION_SHARING), "Version sharing is invalid.");
            Assert.NotNull(savedVersion.DueDate);
            Assert.True(savedVersion.DueDate.Value.Date.Equals(newVersionDueDate.Date), "Version due date is invalid.");
            Assert.True(savedVersion.Description.Equals(NEW_VERSION_DESCRIPTION), "Version description is invalid.");
        }
Пример #2
0
        public void Should_Update_Version()
        {
            const string         UPDATED_VERSION_ID          = "15";
            const string         UPDATED_VERSION_NAME        = "Updated version";
            const VersionStatus  UPDATED_VERSION_STATUS      = VersionStatus.Closed;
            const VersionSharing UPDATED_VERSION_SHARING     = VersionSharing.System;
            const string         UPDATED_VERSION_DESCRIPTION = "Updated description";

            DateTime updatedVersionDueDate = DateTime.Now.AddMonths(1);

            var version = fixture.RedmineManager.GetObject <Version>(UPDATED_VERSION_ID, null);

            version.Name        = UPDATED_VERSION_NAME;
            version.Status      = UPDATED_VERSION_STATUS;
            version.Sharing     = UPDATED_VERSION_SHARING;
            version.DueDate     = updatedVersionDueDate;
            version.Description = UPDATED_VERSION_DESCRIPTION;

            fixture.RedmineManager.UpdateObject(UPDATED_VERSION_ID, version);

            var updatedVersion = fixture.RedmineManager.GetObject <Version>(UPDATED_VERSION_ID, null);

            Assert.NotNull(version);
            Assert.True(updatedVersion.Name.Equals(version.Name), "Version name not updated.");
            Assert.True(updatedVersion.Status.Equals(version.Status), "Status not updated");
            Assert.True(updatedVersion.Sharing.Equals(version.Sharing), "Sharing not updated");
            Assert.True(updatedVersion.DueDate != null && DateTime.Compare(updatedVersion.DueDate.Value.Date, version.DueDate.Value.Date) == 0,
                        "DueDate not updated");
            Assert.True(updatedVersion.Description.Equals(version.Description), "Description not updated");
        }