public void OnDeleteEntityResponse_should_error_if_request_id_not_found() { using (var wrappedOp = WorkerOpFactory.CreateDeleteEntityResponseOp(TestCommandRequestId)) { Assert.Throws <UnknownRequestIdException>(() => { receiveSystem.OnDeleteEntityResponse(wrappedOp.Op); }); } }
public void OnDeleteEntityResponse_should_add_received_responses_to_entity() { var entity = SetupTestEntity(); var emptyRequest = new WorldCommands.DeleteEntity.Request(); var context = "Some context"; deleteEntityStorage.CommandRequestsInFlight.Add(TestCommandRequestId, new CommandRequestStore <WorldCommands.DeleteEntity.Request>(entity, emptyRequest, context, TestCommandRequestId)); using (var wrappedOp = WorkerOpFactory.CreateDeleteEntityResponseOp(TestCommandRequestId)) { receiveSystem.OnDeleteEntityResponse(wrappedOp.Op); Assert.IsTrue(entityManager.HasComponent <WorldCommands.DeleteEntity.CommandResponses>(entity)); var responses = entityManager.GetComponentData <WorldCommands.DeleteEntity.CommandResponses>(entity); var count = 0; Assert.DoesNotThrow(() => { count = responses.Responses.Count; }); Assert.AreEqual(1, count); var response = responses.Responses[0]; Assert.AreEqual(emptyRequest, response.RequestPayload); Assert.AreEqual(context, response.Context); Assert.AreEqual(TestCommandRequestId, response.RequestId); Assert.AreEqual(wrappedOp.Op.StatusCode, response.StatusCode); Assert.AreEqual(wrappedOp.Op.Message, response.Message); Assert.AreEqual(wrappedOp.Op.EntityId, response.EntityId); } }
public void OnDeleteEntityResponse_should_log_if_corresponding_entity_not_found() { var emptyRequest = new WorldCommands.DeleteEntity.Request(); deleteEntityStorage.CommandRequestsInFlight.Add(TestCommandRequestId, new CommandRequestStore <WorldCommands.DeleteEntity.Request>(Entity.Null, emptyRequest, null, TestCommandRequestId)); using (var wrappedOp = WorkerOpFactory.CreateDeleteEntityResponseOp(TestCommandRequestId)) { using (var expectingScope = logDispatcher.EnterExpectingScope()) { expectingScope.Expect(LogType.Log, LoggingUtils.LoggerName, "Op"); receiveSystem.OnDeleteEntityResponse(wrappedOp.Op); } } }