diff --git a/Content.IntegrationTests/NUnit/Constraints/CompConstraintExtensions.cs b/Content.IntegrationTests/NUnit/Constraints/CompConstraintExtensions.cs index 1586c52e03f..34cbe6f682b 100644 --- a/Content.IntegrationTests/NUnit/Constraints/CompConstraintExtensions.cs +++ b/Content.IntegrationTests/NUnit/Constraints/CompConstraintExtensions.cs @@ -20,12 +20,14 @@ public static class CompConstraintExtensions { extension(Has) { + /// public static ResolvableConstraintExpression Comp(IIntegrationInstance instance) where T : IComponent { return new ConstraintExpression().Comp(instance); } + /// public static ResolvableConstraintExpression Comp(Type t, IIntegrationInstance instance) { return new ConstraintExpression().Comp(t, instance); @@ -34,12 +36,52 @@ public static class CompConstraintExtensions extension(ConstraintExpression expr) { + /// + /// Returns a new constraint which will either test for the existence of a + /// on the entity being tested or apply any following constraint to that component. + /// + /// The component Type to check for. + /// The (i.e. Server or Client) on which to perform the test. + /// + /// + /// // Assert that the server-sided entity myEntity has an ItemComponent on the server. + /// Assert.That(myEntity, Has.Comp<ItemComponent>(Server)); + /// + /// // Assert that the server-sided entity myEntity has an ItemComponent with a Size field equal to "Small" + /// Assert.That(myEntity, + /// Has + /// .Comp<ItemComponent>(Server) + /// .Property(nameof(ItemComponent.Size)) + /// .EqualTo("Small") + /// ); + /// + /// public ResolvableConstraintExpression Comp(IIntegrationInstance instance) where T : IComponent { return expr.Append(new CompOperator(typeof(T), instance)); } + /// + /// Returns a new constraint which will either test for the existence of a component of the specified type + /// on the entity being tested or apply any following constraint to that component. + /// + /// The Type of the component to check for. + /// The (i.e. Server or Client) on which to perform the test. + /// + /// + /// // Assert that the server-sided entity myEntity has an ItemComponent on the server. + /// Assert.That(myEntity, Has.Comp(typeof(ItemComponent), Server)); + /// + /// // Assert that the server-sided entity myEntity has an ItemComponent with a Size field equal to "Small" + /// Assert.That(myEntity, + /// Has + /// .Comp(typeof(ItemComponent), Server) + /// .Property(nameof(ItemComponent.Size)) + /// .EqualTo("Small") + /// ); + /// + /// public ResolvableConstraintExpression Comp(Type t, IIntegrationInstance instance) { return expr.Append(new CompOperator(t, instance)); diff --git a/Content.IntegrationTests/NUnit/Constraints/LifeStageConstraint.cs b/Content.IntegrationTests/NUnit/Constraints/LifeStageConstraint.cs index 0539a6b54ef..be6c68da58c 100644 --- a/Content.IntegrationTests/NUnit/Constraints/LifeStageConstraint.cs +++ b/Content.IntegrationTests/NUnit/Constraints/LifeStageConstraint.cs @@ -56,36 +56,43 @@ public static class LifeStageConstraintExtensions { extension(Is) { + /// public static LifeStageConstraint LifeStage(EntityLifeStage stage, IIntegrationInstance instance) { return new LifeStageConstraint(stage, instance); } + /// public static LifeStageConstraint PreInit(IIntegrationInstance instance) { return Is.LifeStage(EntityLifeStage.PreInit, instance); } + /// public static LifeStageConstraint Initializing(IIntegrationInstance instance) { return Is.LifeStage(EntityLifeStage.Initializing, instance); } + /// public static LifeStageConstraint Initialized(IIntegrationInstance instance) { return Is.LifeStage(EntityLifeStage.Initialized, instance); } + /// public static LifeStageConstraint MapInitialized(IIntegrationInstance instance) { return Is.LifeStage(EntityLifeStage.MapInitialized, instance); } + /// public static LifeStageConstraint Terminating(IIntegrationInstance instance) { return Is.LifeStage(EntityLifeStage.Terminating, instance); } + /// public static LifeStageConstraint Deleted(IIntegrationInstance instance) { return Is.LifeStage(EntityLifeStage.Deleted, instance); @@ -94,6 +101,17 @@ public static class LifeStageConstraintExtensions extension(ConstraintExpression expr) { + /// + /// Returns a new constraint that checks if the entity is in the given lifestage. + /// + /// The to check for. + /// The (i.e. Server or Client) on which to perform the test. + /// + /// + /// // Assert that the server-sided entity myEntity is MapInitialized. + /// Assert.That(myEntity, Is.LifeStage(EntityLifeStage.MapInitialized, Server)); + /// + /// public LifeStageConstraint LifeStage(EntityLifeStage stage, IIntegrationInstance instance) { var c = new LifeStageConstraint(stage, instance); @@ -103,31 +121,91 @@ public static class LifeStageConstraintExtensions return c; } + /// + /// Returns a new constraint that checks if the entity is in the PreInit lifestage. + /// + /// The (i.e. Server or Client) on which to perform the test. + /// + /// + /// // Assert that the server-sided entity myEntity has not yet been initialized. + /// Assert.That(myEntity, Is.PreInit(Server)); + /// + /// public LifeStageConstraint PreInit(IIntegrationInstance instance) { return expr.LifeStage(EntityLifeStage.PreInit, instance); } + /// + /// Returns a new constraint that checks if the entity is in the Intializing lifestage. + /// + /// The (i.e. Server or Client) on which to perform the test. + /// + /// + /// // Assert that the server-sided entity myEntity is Initializing. + /// Assert.That(myEntity, Is.Initializing(Server)); + /// + /// public LifeStageConstraint Initializing(IIntegrationInstance instance) { return expr.LifeStage(EntityLifeStage.Initializing, instance); } + /// + /// Returns a new constraint that checks if the entity is in the Initialized lifestage. + /// + /// The (i.e. Server or Client) on which to perform the test. + /// + /// + /// // Assert that the server-sided entity myEntity is Initialized. + /// Assert.That(myEntity, Is.Initialized(Server)); + /// + /// public LifeStageConstraint Initialized(IIntegrationInstance instance) { return expr.LifeStage(EntityLifeStage.Initialized, instance); } + /// + /// Returns a new constraint that checks if the entity is in the MapInitialized lifestage. + /// + /// The (i.e. Server or Client) on which to perform the test. + /// + /// + /// // Assert that the server-sided entity myEntity is MapInitialized. + /// Assert.That(myEntity, Is.MapInitialized(Server)); + /// + /// public LifeStageConstraint MapInitialized(IIntegrationInstance instance) { return expr.LifeStage(EntityLifeStage.MapInitialized, instance); } + /// + /// Returns a new constraint that checks if the entity is in the Terminating lifestage. + /// + /// The (i.e. Server or Client) on which to perform the test. + /// + /// + /// // Assert that the server-sided entity myEntity is Terminating. + /// Assert.That(myEntity, Is.Terminating(Server)); + /// + /// public LifeStageConstraint Terminating(IIntegrationInstance instance) { return expr.LifeStage(EntityLifeStage.Terminating, instance); } + /// + /// Returns a new constraint that checks if the entity is in the Deleted lifestage. + /// + /// The (i.e. Server or Client) on which to perform the test. + /// + /// + /// // Assert that the server-sided entity myEntity is Deleted. + /// Assert.That(myEntity, Is.Deleted(Server)); + /// + /// public LifeStageConstraint Deleted(IIntegrationInstance instance) { return expr.LifeStage(EntityLifeStage.Deleted, instance);