public void AddRemoveTest() { var ch = new Character(); var complex = AspectFactory.Complex(); complex.Host = ch; var test = AspectFactory.Complex(); complex.test = test; Assert.IsNotNull(complex.test); Assert.IsNotNull(complex["test"]); Assert.IsNull(complex["notExists"]); Assert.AreEqual(complex.test, test); Assert.AreEqual(complex["test"], test); Assert.AreEqual(test._host, ch); complex.Remove("test"); Assert.IsNull(complex["test"]); test._host = null; complex["test"] = test; Assert.IsNotNull(complex.test); Assert.IsNotNull(complex["test"]); Assert.IsNull(complex["notExists"]); Assert.AreEqual(complex.test, test); Assert.AreEqual(complex["test"], test); Assert.AreEqual(test._host, ch); }
public void CloneTest() { var mockDestCombat = new Mock <IAspect>(); var mockSrcCombat = new Mock <IAspect>(); mockSrcCombat.Setup(srcCombat => srcCombat.Clone()) .Returns(mockDestCombat.Object); var mockDestStats = new Mock <IAspect>(); var mockSrcStats = new Mock <IAspect>(); mockSrcStats.Setup(srcStats => srcStats.Clone()) .Returns(mockDestStats.Object); var complex = AspectFactory.Complex(); complex.combat = mockSrcCombat.Object; complex.stats = mockSrcStats.Object; var clone = complex.Clone(); Assert.IsNotNull(clone); mockSrcCombat.VerifyAll(); mockDestCombat.VerifyAll(); }
public Entity() { World = World.Instance; names = new List <string>(); Aspects = AspectFactory.Complex(); Aspects.Host = this; }
public void DeserializeTest() { var complex = AspectFactory.Complex(); complex.stats = AspectFactory.Stats(); var data = JsonConvert.DeserializeObject("{ 'stats': {} }"); complex.Deserialize(data); Assert.IsNotNull(complex.stats); }
public void SerializeTest() { var complex = AspectFactory.Complex(); complex.stats = AspectFactory.Stats(); complex.health = AspectFactory.Health(); var data = complex.Serialize(); Assert.IsNotNull(data["stats"]); Assert.IsNotNull(data["health"]); }
public void ReceiveEventTest() { var ch = new Character(); var complex = AspectFactory.Complex(); complex.Host = ch; var test = AspectFactory.Complex(); complex.Add("test", test); var e = Event.Create("test_completed", EventReturnMethod.And); complex.ReceiveEvent(e); Assert.IsTrue(e.ReturnValue); }
public void SetHostTest() { var ch = new Character() { ShortDescr = "test" }; var complex = AspectFactory.Complex(); var test = AspectFactory.Complex(); complex.Add("test", test); complex.Host = ch; Assert.AreEqual(ch, complex.Host); Assert.AreEqual(ch, test.Host); }
public void ComplexTest() { Assert.IsNotNull(AspectFactory.Complex()); }