public void CallSingle_Exception_PassedAndNoOutput() { BrokerContext.Initialize(CprBroker.Utilities.Constants.BaseApplicationToken.ToString(), ""); var facade = new FacadeStub(); var prov = new FacadeStub.ProviderStub() { _GetOne = (s) => { throw new Exception(); } }; FacadeStub.Element[] ret; var elements = new FacadeStub.ElementStub[] { new FacadeStub.ElementStub() { Input = "DDD", Succeeded = true, Updatable = true }, new FacadeStub.ElementStub() { Input = "SSS", Succeeded = true, Updatable = true } }; facade.CallSingle(prov, elements, out ret); Assert.AreEqual("DDD", elements[0].Input); Assert.Null(elements[0].Output); Assert.AreEqual("SSS", elements[1].Input); Assert.Null(elements[1].Output); }
public void CallSingle_Normal_CorrectOuput() { var facade = new FacadeStub(); var prov = new FacadeStub.ProviderStub() { _GetOne = (s) => "ddd" + s, _ImmediateUpdatePreferred = false }; FacadeStub.Element[] ret; facade.CallSingle(prov, new FacadeStub.ElementStub[] { new FacadeStub.ElementStub() { Input = "DDD", Succeeded = true, Updatable = true } }, out ret); Assert.AreEqual("dddDDD", ret[0].Output); }
public void CallSingle_Normal_Success() { var facade = new FacadeStub(); var prov = new FacadeStub.ProviderStub() { _GetOne = (s) => "ddd" + s }; FacadeStub.Element[] ret; facade.CallSingle(prov, new FacadeStub.ElementStub[] { new FacadeStub.ElementStub() { Input = "DDD", Succeeded = true, Updatable = true } }, out ret); Assert.AreEqual(1, facade.updatedInputs.Count + ret.Length); Assert.AreEqual(1, facade.updatedOutputs.Count + ret.Length); }
public void CallSingle_Failed_ResultPropagated() { var facade = new FacadeStub(); var prov = new FacadeStub.ProviderStub() { _GetOne = (s) => s, _ImmediateUpdatePreferred = false }; FacadeStub.Element[] ret; var elements = new FacadeStub.ElementStub[] { new FacadeStub.ElementStub() { Input = "DDD", Succeeded = false, Updatable = false } }; facade.CallSingle(prov, elements, out ret); Assert.AreEqual("DDD", elements[0].Output); }
public void CallSingle_SucceededImmediateUpdateNotPreferred_UpdatePostponed() { var facade = new FacadeStub(); var prov = new FacadeStub.ProviderStub() { _GetOne = (s) => "ddd" + s, _ImmediateUpdatePreferred = false }; FacadeStub.Element[] ret; facade.CallSingle(prov, new FacadeStub.ElementStub[] { new FacadeStub.ElementStub() { Input = "DDD", Succeeded = true, Updatable = true } }, out ret); Assert.AreEqual(1, ret.Length); Assert.AreEqual(0, facade.updatedInputs.Count); Assert.AreEqual(0, facade.updatedOutputs.Count); }