Exemplo n.º 1
0
        public void TestThatFunctionalitySetterRaisePropertyChangedIfValueIsChanged()
        {
            var fixture = new Fixture();

            var markFunctionality = new MarkFunctionality(fixture.CreateAnonymous <string>());

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

            var eventCalled = false;

            markFunctionality.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);
                if (e.PropertyName.Equals("Functionality"))
                {
                    eventCalled = true;
                }
            });

            var newValue = fixture.CreateAnonymous <string>();

            markFunctionality.Functionality = newValue;
            Assert.That(markFunctionality.Functionality, Is.EqualTo(newValue));
            Assert.That(eventCalled, Is.True);
        }
Exemplo n.º 2
0
        public void TestThatFunctionalitySetterThrowsAnArgumentNullExceptionIfValueIsNull()
        {
            var fixture = new Fixture();

            var markFunctionality = new MarkFunctionality(fixture.CreateAnonymous <string>());

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

            Assert.Throws <ArgumentNullException>(() => markFunctionality.Functionality = null);
        }
Exemplo n.º 3
0
        public void TestThatConstructorInitializeAMarkFunctionality()
        {
            var fixture   = new Fixture();
            var markValue = fixture.CreateAnonymous <string>();

            var markFunctionality = new MarkFunctionality(markValue);

            Assert.That(markFunctionality, Is.Not.Null);
            Assert.That(markFunctionality.Name, Is.Not.Null);
            Assert.That(markFunctionality.Name, Is.Not.Empty);
            Assert.That(markFunctionality.Name, Is.EqualTo("MarkFunctionality"));
            Assert.That(markFunctionality.Functionality, Is.Not.Null);
            Assert.That(markFunctionality.Functionality, Is.Not.Empty);
            Assert.That(markFunctionality.Functionality, Is.EqualTo(markValue));
            Assert.That(markFunctionality.XmlValue, Is.Not.Null);
            Assert.That(markFunctionality.XmlValue, Is.Not.Empty);
            Assert.That(markFunctionality.XmlValue, Is.EqualTo(markFunctionality.Functionality));
        }