public void Can_Get_Guid_QueryValue() { // arrange const string key = "some-id"; var filterQuery = $"filter[{key}]"; var value = Guid.NewGuid(); var query = new Dictionary <string, StringValues> { { filterQuery, value.ToString() } }; _queryMock.Setup(q => q.GetEnumerator()).Returns(query.GetEnumerator()); var querySet = new QuerySet(_contextMock.Object, _queryMock.Object); _contextMock.Setup(c => c.QuerySet) .Returns(querySet); var service = new QueryAccessor(_contextMock.Object, _loggerMock.Object); // act var success = service.TryGetValue <Guid>("SomeId", out Guid result); // assert Assert.True(success); Assert.Equal(value, result); }
public void Can_Get_Guid_QueryValue() { // arrange const string key = "SomeId"; var value = Guid.NewGuid(); var querySet = new QuerySet { Filters = new List <FilterQuery> { new FilterQuery(key, value.ToString(), "eq") } }; _contextMock.Setup(c => c.QuerySet).Returns(querySet); var service = new QueryAccessor(_contextMock.Object, _loggerMock.Object); // act var success = service.TryGetValue <Guid>("SomeId", out Guid result); // assert Assert.True(success); Assert.Equal(value, result); }