public async Task QueryAllHappyPath() { string name = "config-name"; var entity = new ConfigEntity(); var entities = new List <ConfigEntity> { entity }; model.AllEntitesAsync().Returns((IEnumerable <ConfigEntity>)entities); var context = new QueryContext(name, QueryTypes.AllValues, model); var result = await AllQueries.QueryAllConfigEntityValuesAsync(context); Assert.IsType <ConfigCollection>(result.Result); Assert.Same(entity, ((ConfigCollection)(result.Result)).WrappedConfigEntities.First()); Assert.True(result.IsSuccess); }
public async Task QueryAllThrowsOnWrongQueryType() { var context = new QueryContext("does-not-matter", QueryTypes.ValueRequest, model); await Assert.ThrowsAsync <ArgumentException>(async() => await AllQueries.QueryAllConfigEntityValuesAsync(context)); }
public async Task NullContextThrows() { await Assert.ThrowsAsync <ArgumentException>(async() => await AllQueries.QueryConfigEntityAsync(null)); await Assert.ThrowsAsync <ArgumentException>(async() => await AllQueries.QueryAllConfigEntityValuesAsync(null)); }