public void TestThatNameSetterRaisePropertyChangedIfValueIsChanged()
        {
            var fixture = new Fixture();

            var functionality = new MyFunctionality(fixture.CreateAnonymous <string>(), fixture.CreateAnonymous <object>());

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

            var eventCalled = false;

            functionality.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("Name"))
                {
                    eventCalled = true;
                }
            });

            functionality.Name = functionality.Name;
            Assert.That(eventCalled, Is.False);

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

            functionality.Name = newValue;
            Assert.That(functionality.Name, Is.EqualTo(newValue));
            Assert.That(eventCalled, Is.True);
        }
            public void TestInheritance()
            {
                IFunctionality instInterface = new MyFunctionality();

                Console.WriteLine("Type is (" + instInterface.GetIdentifier() + ")");
                instInterface.Method();
            }
        public void TestThatFunctionalitySetterThrowsAnArgumentNullExceptionIfValueIsNull()
        {
            var fixture = new Fixture();

            var functionality = new MyFunctionality(fixture.CreateAnonymous <string>(), fixture.CreateAnonymous <object>());

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

            Assert.Throws <ArgumentNullException>(() => functionality.Functionality = null);
        }
            public void TestInheritance()
            {
                MyFunctionality      instDerived   = new MyFunctionality();
                DefaultFunctionality instBase      = instDerived;
                IFunctionality       instInterface = instDerived;

                Console.WriteLine("Type is (" + instInterface.GetIdentifier() + ")");
                Console.WriteLine("Calling the interface");
                instInterface.Method();
                Console.WriteLine("Calling the derived");
                instDerived.Method();
                Console.WriteLine("Calling the base class");
                instBase.Method();
            }
        public void TestThatConstructorInitializeAFunctionality()
        {
            var fixture = new Fixture();
            var name    = fixture.CreateAnonymous <string>();
            var obj     = fixture.CreateAnonymous <object>();

            var functionality = new MyFunctionality(name, obj);

            Assert.That(functionality, Is.Not.Null);
            Assert.That(functionality.Name, Is.Not.Null);
            Assert.That(functionality.Name, Is.Not.Empty);
            Assert.That(functionality.Name, Is.EqualTo(name));
            Assert.That(functionality.Value, Is.Not.Null);
            Assert.That(functionality.Value, Is.EqualTo(obj));
            Assert.That(functionality.Functionality, Is.Not.Null);
            Assert.That(functionality.Functionality, Is.EqualTo(obj));
            Assert.That(functionality.XmlValue, Is.Not.Null);
            Assert.That(functionality.XmlValue, Is.Not.Empty);
            Assert.That(functionality.XmlValue, Is.EqualTo(obj.GetType().Name));
        }