public void DispatchByNullDataJobShouldThrowArgumentNullException() { // Arrange var jobDispatcher = GetJobDispatcher(); var job = new FooJob(VALID_JOB_NAME, null); // Act // Assert Assert.Throws <ArgumentNullException>(nameof(job.Data), () => { jobDispatcher.Dispatch(job); }); }
void Start() { UnityEngine.Debug.LogWarning("SIZE = " + sizeof(Test)); using (var foo = new NativeArray <int>(1, Allocator.Persistent)) { var jh = FooJob.Create(foo).Schedule(); jh.Complete(); UnityEngine.Debug.LogWarning("BURST_SIZE = " + foo[0]); } }
public void DispatchByValidJobShouldReturnTrue() { // Arrange var jobDispatcher = GetJobDispatcher(); var job = new FooJob(VALID_JOB_NAME, new FooData()); // Act var result = jobDispatcher.Dispatch(job); // Assert Assert.True(result); }
public void DispatchByNotNullJobShouldHitJobNameValidatorValidate() { // Arrange var jobDispatcher = GetJobDispatcher(); var job = new FooJob(VALID_JOB_NAME, new FooData()); // Act var result = jobDispatcher.Dispatch(job); // Assert _jobNameValidator.Verify(x => x.Validate(VALID_JOB_NAME), Times.Once); }
public void DispatchByAnyJobIfSendThrowAnyExceptionShouldThrowException() { // Arrange var jobDispatcher = GetJobDispatcher(); var job = new FooJob(VALID_JOB_NAME, new FooData()); _messageQueue.Setup(x => x.Send(It.IsAny <string>(), It.IsAny <string>())).Throws <Exception>(); // Act // Assert Assert.Throws <Exception>(() => { jobDispatcher.Dispatch(job); }); }
public void DispatchAsyncByValidJobShouldReturnTrue() { // Arrange var jobDispatcher = GetJobDispatcher(); var job = new FooJob(VALID_JOB_NAME, new FooData()); // Act var task = Task.Run(() => jobDispatcher.DispatchAsync(job)); task.Wait(); // Assert Assert.True(task.Result); }
public void DispatchByAnyJobIfSendReturnsFalseShouldReturnFalse() { // Arrange var jobDispatcher = GetJobDispatcher(); var job = new FooJob(VALID_JOB_NAME, new FooData()); _messageQueue.Setup(x => x.Send(It.IsAny <string>(), It.IsAny <string>())).Returns(false); // Act var result = jobDispatcher.Dispatch(job); // Assert Assert.False(result); }