public void Test_FakeObservableBO_ShouldImplementIDataErrorInfo()
        {
            //---------------Set up test pack-------------------

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var FakeObservableBO = new FakeObservableBO();

            //---------------Test Result -----------------------
            Assert.IsInstanceOf <IDataErrorInfo>(FakeObservableBO);
        }
        public void Test_FakeObservableBO_ShouldImplementINotifyPropertyChangedEvent()
        {
            //---------------Set up test pack-------------------

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var FakeObservableBO = new FakeObservableBO();

            //---------------Test Result -----------------------
            Assert.IsInstanceOf <INotifyPropertyChanged>(FakeObservableBO);
        }
        public void Test_this_WithFirstName_WhenPropHasError_ShouldShowError()
        {
            //---------------Set up FakeObservableBO pack-------------------
            var FakeObservableBO = new FakeObservableBO();
            var boTester         = new BOTester <FakeObservableBO>();

            //---------------Assert Precondition----------------
            boTester.ShouldBeCompulsory(emp => emp.Prop1);
            //---------------Execute Test ----------------------
            var errorForFirstName = FakeObservableBO["Prop1"];

            //---------------Test Result -----------------------
            StringAssert.Contains("FakeObservableBO.Prop 1' is a compulsory field and has no value", errorForFirstName);
        }
        public void Test_Error_WhenPropHasError_ShouldShowError()
        {
            //---------------Set up test pack-------------------
            var FakeObservableBO = new FakeObservableBO();
            var boTester         = new BOTester <FakeObservableBO>();

            //---------------Assert Precondition----------------
            boTester.ShouldBeCompulsory(emp => emp.Prop1);
            boTester.ShouldBeCompulsory(emp => emp.Prop2);
            //---------------Execute Test ----------------------
            var error = FakeObservableBO.Error;

            //---------------Test Result -----------------------
            StringAssert.Contains("FakeObservableBO.Prop 1' is a compulsory field and has no value", error);
            StringAssert.Contains("FakeObservableBO.Prop 2' is a compulsory field and has no value", error);
        }
        public void Test_SetPropertyValue_ViaBOProp_ShouldRaiseINotifyPropertyChangedEvent()
        {
            //---------------Set up test pack-------------------
            BORegistry.DataAccessor = new DataAccessorInMemory();
            var FakeObservableBO    = new FakeObservableBO();
            var propertyThatChanged = "";

            FakeObservableBO.PropertyChanged += (sender, args) => propertyThatChanged = args.PropertyName;
            //---------------Assert Precondition----------------
            Assert.IsInstanceOf <INotifyPropertyChanged>(FakeObservableBO);
            Assert.IsEmpty(propertyThatChanged, "No property has changed yet");
            //---------------Execute Test ----------------------
            FakeObservableBO.SetPropertyValue("Prop2", GetRandomString());
            //---------------Test Result -----------------------
            Assert.AreEqual("Prop2", propertyThatChanged,
                            "PropertyChanged Event for Prop2 should have been fired");
        }
        public void Test_SetPropertyValue_WhenConstructedWithClassDef_ShouldRaiseINotifyPropertyChangedEvent()
        {
            //---------------Set up test pack-------------------
            BORegistry.DataAccessor = new DataAccessorInMemory();
            var classDef            = ClassDef.Get <FakeObservableBO>();
            var FakeObservableBO    = new FakeObservableBO(classDef);
            var propertyThatChanged = "";

            FakeObservableBO.PropertyChanged += (sender, args) => propertyThatChanged = args.PropertyName;
            //---------------Assert Precondition----------------
            Assert.IsInstanceOf <INotifyPropertyChanged>(FakeObservableBO);
            Assert.IsEmpty(propertyThatChanged, "No property has changed yet");
            //---------------Execute Test ----------------------
            FakeObservableBO.Prop1 = GetRandomString();
            //---------------Test Result -----------------------
            Assert.AreEqual("Prop1", propertyThatChanged,
                            "PropertyChanged Event for FirstName should have been fired");
        }