Esempio n. 1
0
        public void ErrorResultTO_Remove_ShouldJustRemoveTheErrorInTheCollection()
        {
            var errorResultTo = new ErrorResultTO();

            Assert.AreEqual(0, errorResultTo.FetchErrors().Count);
            errorResultTo.AddError("SomeError");

            Assert.AreEqual(1, errorResultTo.FetchErrors().Count);

            errorResultTo.RemoveError("SomeError");
            Assert.AreEqual(0, errorResultTo.FetchErrors().Count);
        }
        public void ErrorResultTO_Remove_ShouldJustRemoveTheErrorInTheCollection()
        {
            ErrorResultTO errorResultTo = new ErrorResultTO();

            Assert.IsNotNull(errorResultTo);
            var prObj  = new PrivateObject(errorResultTo);
            var errors = prObj.GetField("_errorList") as IList <string>;

            Assert.IsNotNull(errors);
            Assert.AreEqual(0, errors.Count);
            errorResultTo.AddError("SomeError");
            errors = prObj.GetField("_errorList") as IList <string>;
            if (errors != null)
            {
                Assert.AreEqual(1, errors.Count);
            }
            errorResultTo.RemoveError("SomeError");
            if (errors != null)
            {
                Assert.AreEqual(0, errors.Count);
            }
        }