Exemplo n.º 1
0
        public void AddModelToGroupCommand_Constructors()
        {
            //Arrange
            var guid1 = Guid.NewGuid();
            var guid2 = Guid.NewGuid();
            var guid3 = Guid.NewGuid();
            IEnumerable <Guid> groupModelGuid = new[] { guid3 };
            XmlDocument        xmlDocument    = new XmlDocument();
            var xmlElement = xmlDocument.CreateElement("ModelGroupElement");

            //Act
            var command1 = new AddModelToGroupCommand(guid1.ToString());
            var command2 = new AddModelToGroupCommand(guid2);
            var command3 = new AddModelToGroupCommand(groupModelGuid);

            AddModelToGroupCommand.DeserializeCore(xmlElement);
            command1.Serialize(xmlDocument);
            command1.Execute(CurrentDynamoModel);

            //Assert
            //Verify that the guid in the commands created are right
            Assert.IsNotNull(command1);
            Assert.IsNotNull(command2);
            Assert.IsNotNull(command3);
        }
Exemplo n.º 2
0
        public void UngroupGrouplImplTest()
        {
            //Arrange
            var guid1    = Guid.Empty;
            var command1 = new AddModelToGroupCommand(guid1);
            var command2 = new UngroupModelCommand(guid1);

            //Act
            //Internally this will execute the AddToGroupImpl method
            command1.Execute(CurrentDynamoModel);
            //Internally this will execute the UngroupModelImpl method
            command2.Execute(CurrentDynamoModel);

            //Assert
            //Verify that the command was created successfully and that the guids match
            Assert.IsNotNull(command1);
            Assert.AreEqual(command1.ModelGuid, guid1);
            Assert.IsNotNull(command2);
            Assert.AreEqual(command2.ModelGuid, guid1);
        }