Example #1
0
        public async Task ReadOnlyFieldsShouldBeRemoved()
        {
            var config = new TestConfig();
            var client = new Client(config.Token);

            var update = new WorkItemUpdate
            {
                Fields = await ReadOnlyFields(config, client)
            };

            var processor = new ReadOnlyFields();
            await processor.Execute(update);

            update
            .Fields
            .Keys
            .Should()
            .BeSubsetOf(new[]
            {
                "System.RevisedDate",
                "System.ChangedDate",
                "System.AuthorizedAs",
                "System.AuthorizedDate",
                "System.CreatedDate",
                "System.CreatedBy"
            });
        }
Example #2
0
        public void ShouldCreateTreeWithReadOnlyFields()
        {
            ReadOnlyFields rof = null;

            try
            {
                rof = new DependencyInjector().CreateAndInjectDependencies <ReadOnlyFields>().rootBean;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
                Assert.Fail();
            }
            Assert.IsNotNull(rof);
            Assert.IsNotNull(rof?.GetResults().Field);
        }
Example #3
0
        public void MakeFieldsReadOnly_GivenOldFilePathAndNewFilePathWithFieldsToDisable_ShouldDisableFieldsAndNewFileByteShouldBeBigger()
        {
            //Arrange
            var    sut         = new ReadOnlyFields();
            string oldFileName = "populatedAsposeBootCamp.pdf";
            string newFileName = "Readonly.pdf.pdf";

            string [] fieldsToDisable = new string[] { "FirstName", "Surname", "Date_of_birth" };

            var baseDirectory = TestContext.CurrentContext.TestDirectory;
            var oldFilePath   = Path.Combine(baseDirectory, oldFileName);
            var newFilePath   = Path.Combine(baseDirectory, newFileName);

            //Act
            sut.MakeFieldsReadOnly(oldFilePath, newFilePath, fieldsToDisable);

            //Assert
            var originalBytes = File.ReadAllBytes(oldFilePath);
            var readonlyBytes = File.ReadAllBytes(newFilePath);

            Assert.AreNotEqual(originalBytes, readonlyBytes);
        }