public void Throws_InvalidOperationException_If_Element_Name_Is_Not_ContextAttribute()
        {
            //Arrange
            var rad = new ContextAttributeDeserializer();

            //Act
            rad.Deserialize(new XElement("foo"));
        }
        public void Throws_ArgumentNullException_If_Element_Is_Null()
        {
            //Arrange
            var rad = new ContextAttributeDeserializer();

            //Assert
            Assert.Throws <ArgumentNullException>(() => rad.Deserialize(null));
        }
        public void Deserialize_Returns_Correct_Object_With_Less_Data_Input()
        {
            //Arrange
            var xml = new XElement("ContextAttribute", new XAttribute("name", "foo"));

            var des = new ContextAttributeDeserializer();

            //Act
            var actual = (ContextAttribute)des.Deserialize(xml);

            //Assert
            Assert.That(actual, Is.Not.Null);
            Assert.That(actual.Name, Is.EqualTo("foo"));
        }
        public void Can_Deserialize_ContextAttribute_Xml()
        {
            //Arrange
            var xml =
                new XElement("ContextAttribute",
                             new XAttribute("name", "foo"),
                             new XElement("Value", "Foo/Bar"),
                             new XElement("Value", "Bar/Foo"));


            var expected = ContextAttribute.New("foo", new[] { "Foo/Bar", "Bar/Foo" });

            var rad = new ContextAttributeDeserializer();

            //Act
            var actual = (ContextAttribute)rad.Deserialize(xml);

            //Assert
            Assert.That(actual.Name, Is.EqualTo(expected.Name));

            Assert.That(actual.Values.ElementAt(0), Is.EqualTo(expected.Values.ElementAt(0)));
            Assert.That(actual.Values.ElementAt(1), Is.EqualTo(expected.Values.ElementAt(1)));
        }