public GetSampleEntities ( dynamic message ) : void | ||
message | dynamic | The dynamic message from the bus containig the details of the item to retrive |
Résultat | void |
public void GetOperationLogsEntityNotFound() { var publisher = new Mock<IMessagePublisher>(); var logger = new Mock<ILogger>(); var repo = new Mock<IRepository<SampleEntity>>(); var env = new Mock<IEnvironment>(); var logicClass = new DataOperations(logger.Object, publisher.Object, repo.Object, env.Object); var message = TestMessages.GetTestReadSampleEntityMessage(); var entitys = TestEntities.SetUpSampleEntities(message); var logList = new List<string>(); var responseList = new List<dynamic>(); publisher.Setup(p => p.Publish(It.IsAny<object>(), It.IsAny<string>())) .Callback<dynamic, string>((msg, str) => responseList.Add(msg)); logger.Setup(l => l.Error(It.IsAny<Exception>(), It.IsAny<string>(), It.IsAny<object[]>())) .Callback<Exception, string, object[]>((ex, msg, obj) => logList.Add(msg)); repo.Setup(r => r.GetById(It.IsAny<string>())).Throws(new Exception("test exception")); logicClass.GetSampleEntities(message); Assert.IsTrue(logList[0].Contains("Unable to retrived entity")); }
public void GetOperationRetrivesSingleEntityByPrimaryKey() { var publisher = new Mock<IMessagePublisher>(); var logger = new Mock<ILogger>(); var repo = new FakeRepository(); var env = new Mock<IEnvironment>(); var logicClass = new DataOperations(logger.Object, publisher.Object, repo, env.Object); var message = TestMessages.GetTestReadSampleEntityMessage(); var entitys = TestEntities.SetUpSampleEntities(message); var responseList = new List<dynamic>(); publisher.Setup(p => p.Publish(It.IsAny<object>(), It.IsAny<string>())).Callback<dynamic, string>((msg, str) => responseList.Add(msg)); repo.Entities = entitys; logicClass.GetSampleEntities(message); var result = JObject.Parse(responseList[0]); Assert.IsTrue(message.Needs[0].SampleUuid.ToString() == result.Solutions[0].SampleUuid.ToString()); }
public void GetOperationLogsEntityFound() { var publisher = new Mock<IMessagePublisher>(); var logger = new Mock<ILogger>(); var repo = new FakeRepository(); var env = new Mock<IEnvironment>(); var logicClass = new DataOperations(logger.Object, publisher.Object, repo, env.Object); var message = TestMessages.GetTestReadSampleEntityMessage(); var entitys = TestEntities.SetUpSampleEntities(message); var logList = new List<string>(); var responseList = new List<dynamic>(); publisher.Setup(p => p.Publish(It.IsAny<object>(), It.IsAny<string>())) .Callback<dynamic, string>((msg, str) => responseList.Add(msg)); logger.Setup(l => l.Info(It.IsAny<string>(), It.IsAny<object[]>())) .Callback<string, object[]>((msg, obj) => logList.Add(msg)); repo.Entities = entitys; logicClass.GetSampleEntities(message); Assert.IsTrue(logList[1].Contains("Retrived entity")); }