public void GetEntity_should_not_throw_with_arbritrary_components() { var exhaustiveSingular = new ExhaustiveSingular.Snapshot { Field7 = "", Field3 = new byte[] { }, }; var template = GetBasicTemplate(); template.AddComponent(exhaustiveSingular, "write-access"); Assert.IsFalse(DidGetEntityThrow(template)); }
public void HasComponent_type_erased_should_return_true_if_component_present() { var exhaustiveSingular = new ExhaustiveSingular.Snapshot { Field7 = "", Field3 = new byte[] { } }; var template = GetBasicTemplate(); template.AddComponent(exhaustiveSingular, "write-access"); Assert.IsTrue(template.HasComponent(ExhaustiveSingular.ComponentId)); }
public void GetComponent_should_return_the_component_if_present() { var template = GetBasicTemplate(); var exhaustiveSingular = new ExhaustiveSingular.Snapshot { Field2 = 100 // Field to test equality for. }; template.AddComponent(exhaustiveSingular, ""); var returned = template.GetComponent <ExhaustiveSingular.Snapshot>(); Assert.IsTrue(returned.HasValue); Assert.AreEqual(exhaustiveSingular.Field2, returned.Value.Field2); }
public void RemoveComponent_type_erased_should_remove_component_if_present() { var exhaustiveSingular = new ExhaustiveSingular.Snapshot { Field7 = "", Field3 = new byte[] { } }; var template = GetBasicTemplate(); template.AddComponent(exhaustiveSingular, ""); template.RemoveComponent(ExhaustiveSingular.ComponentId); Assert.IsFalse(template.GetComponent <ExhaustiveSingular.Snapshot>().HasValue); }
public void SetComponent_type_erased_should_replace_the_underlying_component() { var originalSnapshot = new ExhaustiveSingular.Snapshot { Field7 = "", Field3 = new byte[] { } }; var template = GetBasicTemplate(); template.AddComponent(originalSnapshot, ""); var snapshotToReplace = (ISpatialComponentSnapshot) new ExhaustiveSingular.Snapshot { Field2 = 100 // Field to test equality for. }; template.SetComponent(snapshotToReplace); var component = template.GetComponent <ExhaustiveSingular.Snapshot>().Value; Assert.AreEqual(100, component.Field2); }