示例#1
0
        public void WriteTo(Stream out1)
        {
            TableDocument doc = new TableDocument();

            doc.SetTable(ctTable);
            doc.Save(out1);
        }
示例#2
0
        public void TestThatConstructorInitializeTableDocumentWithDescription()
        {
            var fixture = new Fixture();

            var id            = fixture.CreateAnonymous <int>();
            var nameSource    = fixture.CreateAnonymous <string>();
            var nameTarget    = fixture.CreateAnonymous <string>();
            var reference     = fixture.CreateAnonymous <string>();
            var description   = fixture.CreateAnonymous <string>();
            var tableDocument = new TableDocument(id, nameSource, nameTarget, reference, description);

            Assert.That(tableDocument, Is.Not.Null);
            Assert.That(tableDocument.Id, Is.EqualTo(id));
            Assert.That(tableDocument.NameSource, Is.Not.Null);
            Assert.That(tableDocument.NameSource, Is.Not.Empty);
            Assert.That(tableDocument.NameSource, Is.EqualTo(nameSource));
            Assert.That(tableDocument.NameTarget, Is.Not.Null);
            Assert.That(tableDocument.NameTarget, Is.Not.Empty);
            Assert.That(tableDocument.NameTarget, Is.EqualTo(nameTarget));
            Assert.That(tableDocument.Reference, Is.Not.Null);
            Assert.That(tableDocument.Reference, Is.Not.Empty);
            Assert.That(tableDocument.Reference, Is.EqualTo(reference));
            Assert.That(tableDocument.Description, Is.Not.Null);
            Assert.That(tableDocument.Description, Is.Not.Empty);
            Assert.That(tableDocument.Description, Is.EqualTo(description));
            Assert.That(tableDocument.Field, Is.Null);
        }
示例#3
0
        public void UploadDocument(string username, string projectGuid, string documentName, string mimeType, string path, int version, string comment, int documentTypeId)
        {
            TableDocument document = new TableDocument()
            {
                user_name        = username,
                project_guid     = projectGuid,
                document_name    = documentName,
                mime_type        = mimeType,
                path             = path,
                version          = version,
                comment          = comment,
                upload_time      = DateTime.Now,
                document_type_id = documentTypeId
            };

            m_db.Insert("Document", "document_id", true, document);

            int projectId = DbUtils.GetIdByGuid(projectGuid, "[dbo].[Project]", "project_guid");

            if (version > 1)
            {
                Logger.Log(projectId, "上传文档《" + documentName + "》新版本" + "V" + version);
            }
            else
            {
                Logger.Log(projectId, "上传文档《" + documentName + "》");
            }
        }
示例#4
0
        public void TestThatFieldSetterRaisesPropertyChangedEvent()
        {
            var fixture = new Fixture();

            var tableDocument = new TableDocument(fixture.CreateAnonymous <int>(), fixture.CreateAnonymous <string>(), fixture.CreateAnonymous <string>(), fixture.CreateAnonymous <string>());

            Assert.That(tableDocument, Is.Not.Null);

            var eventCalled = false;

            tableDocument.PropertyChanged += (s, e) =>
            {
                Assert.That(s, Is.Not.Null);
                Assert.That(e, Is.Not.Null);
                Assert.That(e.PropertyName, Is.Not.Null);
                Assert.That(e.PropertyName, Is.Not.Empty);
                Assert.That(e.PropertyName, Is.EqualTo("Field"));
                eventCalled = true;
            };

            tableDocument.Field = tableDocument.Field;
            Assert.That(eventCalled, Is.False);

            tableDocument.Field = MockRepository.GenerateMock <IField>();
            Assert.That(eventCalled, Is.True);
        }
示例#5
0
        public void WriteTo(Stream out1)
        {
            UpdateHeaders();
            TableDocument doc = new TableDocument();

            doc.SetTable(ctTable);
            doc.Save(out1);
        }
示例#6
0
        public void WriteTo(Stream out1)
        {
            this.UpdateHeaders();
            TableDocument tableDocument = new TableDocument();

            tableDocument.SetTable(this.ctTable);
            tableDocument.Save(out1);
        }
示例#7
0
 public void ReadFrom(Stream is1)
 {
     try
     {
         this.ctTable = TableDocument.Parse(is1).GetTable();
     }
     catch (XmlException ex)
     {
         throw new IOException(ex.Message);
     }
 }
示例#8
0
 public void ReadFrom(Stream is1)
 {
     try
     {
         TableDocument doc = TableDocument.Parse(is1);
         ctTable = doc.GetTable();
     }
     catch (XmlException e)
     {
         throw new IOException(e.Message);
     }
 }
示例#9
0
 public void ReadFrom(XmlDocument xmlDoc)
 {
     try
     {
         TableDocument doc = TableDocument.Parse(xmlDoc, NamespaceManager);
         ctTable = doc.GetTable();
     }
     catch (XmlException e)
     {
         throw new IOException(e.Message);
     }
 }
示例#10
0
        public void TestThatFieldSetterChangedValue()
        {
            var fixture = new Fixture();

            var tableDocument = new TableDocument(fixture.CreateAnonymous <int>(), fixture.CreateAnonymous <string>(), fixture.CreateAnonymous <string>(), fixture.CreateAnonymous <string>());

            Assert.That(tableDocument, Is.Not.Null);

            var newValue = MockRepository.GenerateMock <IField>();

            tableDocument.Field = newValue;

            Assert.That(tableDocument.Field, Is.EqualTo(newValue));
        }