public void CanGiven() { var container = new CatLib.Stl.Container(); var bindData = new CatLib.Stl.BindData(container, "CanGiven", (app, param) => "hello world", false); var givenData = new CatLib.Stl.GivenData(bindData); givenData.Needs("needs1"); givenData.Given("hello"); Assert.AreEqual("hello", bindData.GetContextual("needs1")); givenData = new CatLib.Stl.GivenData(bindData); givenData.Needs("needs2"); givenData.Given <GivenDataTest>(); Assert.AreEqual(typeof(GivenDataTest).ToString(), bindData.GetContextual("needs2")); }
public void CheckGivenIllegalValue() { var container = new CatLib.Stl.Container(); var bindData = new CatLib.Stl.BindData(container, "CanGiven", (app, param) => "hello world", false); var givenData = new CatLib.Stl.GivenData(bindData); givenData.Needs("needs"); ExceptionAssert.Throws <ArgumentNullException>(() => { givenData.Given(null); }); ExceptionAssert.Throws <ArgumentNullException>(() => { givenData.Given(string.Empty); }); }