Example #1
0
        static void Main()
        {
            string content = "1,2,3\n" +
                             "4,5,6\n" +
                             "7,8,9";

            bool isValid = ValidationService.Validate(DataValidators.CsvValidator, content);

            if (isValid)
            {
                int  id            = MetadataService.CreateMetadata("3x3 Matrix of first nine numbers", "Andy Phelps");
                bool wasSuccessful = UploadService.UploadData(id, content);
                if (wasSuccessful)
                {
                    ActivationService.Activate(id);
                }
            }
        }
Example #2
0
        public void TestCreateMetadata()
        {
            //Arrange
            manager.DatabaseConnection();
            metadata.SetDatabase(manager.GetDatabase());
            KeyId.SetKey();
            string        id    = KeyId.GetKey();
            MetadataModel model = new MetadataModel()
            {
                Id      = id,
                Name    = "Processo Teste",
                Version = 1,
                Date    = DateTime.Now.ToLocalTime(),
                Branch  = new List <string>()
                {
                    "5ce95aab70eb31116c6ca8d6"
                },
                State = "5ceac39b5cef382144c73570",
                Field = new List <string>()
                {
                    "5524d0b0562246673447c8e2"
                }
            };

            //Act
            string result = metadata.CreateMetadata(model);

            if (Convert.ToInt32(result) == 201)
            {
                Assert.Pass("Result: Metadata process with id = " + id + ", was created with success");
            }
            else if (Convert.ToInt32(result) == 400)
            {
                Assert.Pass("Result: Metadata process with id = " + id + ", was not created");
            }
            Assert.Fail();
        }