async Task HasAuthorizedKeys()
            {
                var repo = mockup.Get <IAuthorizedKeyRepository>();
                await repo.AddRange(new AuthorizedKeyInput[] { AuthorizedKeyTests.CreateInput(), AuthorizedKeyTests.CreateInput(), AuthorizedKeyTests.CreateInput() });

                Assert.True(await repo.HasAuthorizedKeys());
            }
            async Task Add()
            {
                var repo   = mockup.Get <IAuthorizedKeyRepository>();
                var result = await repo.Add(AuthorizedKeyTests.CreateInput());

                Assert.NotNull(result);
            }
            async Task Add()
            {
                var controller = mockup.Get <AuthorizedKeysController>();

                var result = await controller.Add(AuthorizedKeyTests.CreateInput());

                Assert.NotNull(result);
            }
Пример #4
0
            void InputToEntity()
            {
                var mapper = mockup.Get <AppMapper>();
                var input  = AuthorizedKeyTests.CreateInput();
                var entity = mapper.MapAuthorizedKey(input, new AuthorizedKeyEntity());

                //Make sure the id does not copy over
                Assert.Equal(default(Guid), entity.AuthorizedKeyId);
                AssertEqual(input, entity);
            }
            async Task Get()
            {
                var dbContext = mockup.Get <AppDbContext>();
                var repo      = mockup.Get <IAuthorizedKeyRepository>();
                await repo.AddRange(new AuthorizedKeyInput[] { AuthorizedKeyTests.CreateInput(), AuthorizedKeyTests.CreateInput(), AuthorizedKeyTests.CreateInput() });

                var result = await repo.Add(AuthorizedKeyTests.CreateInput());

                Assert.Equal <int>(4, dbContext.AuthorizedKeys.Count());
                var getResult = await repo.Get(result.AuthorizedKeyId);

                Assert.NotNull(getResult);
            }
            async Task List()
            {
                //This could be more complete
                var repo = mockup.Get <IAuthorizedKeyRepository>();
                await repo.AddRange(new AuthorizedKeyInput[] { AuthorizedKeyTests.CreateInput(), AuthorizedKeyTests.CreateInput(), AuthorizedKeyTests.CreateInput() });

                var query  = new AuthorizedKeyQuery();
                var result = await repo.List(query);

                Assert.Equal(query.Limit, result.Limit);
                Assert.Equal(query.Offset, result.Offset);
                Assert.Equal(3, result.Total);
                Assert.NotEmpty(result.Items);
            }
            async Task Delete()
            {
                var controller = mockup.Get <AuthorizedKeysController>();

                var result = await controller.Add(AuthorizedKeyTests.CreateInput());

                Assert.NotNull(result);

                var listResult = await controller.List(new AuthorizedKeyQuery());

                Assert.Equal(1, listResult.Total);

                await controller.Delete(result.AuthorizedKeyId);

                listResult = await controller.List(new AuthorizedKeyQuery());

                Assert.Equal(0, listResult.Total);
            }
            async Task Get()
            {
                var totalItems = 3;

                var controller = mockup.Get <AuthorizedKeysController>();

                for (var i = 0; i < totalItems; ++i)
                {
                    Assert.NotNull(await controller.Add(AuthorizedKeyTests.CreateInput()));
                }

                //Manually add the item we will look back up
                var lookup = await controller.Add(AuthorizedKeyTests.CreateInput());

                var result = await controller.Get(lookup.AuthorizedKeyId);

                Assert.NotNull(result);
            }
            async Task List()
            {
                var totalItems = 3;

                var controller = mockup.Get <AuthorizedKeysController>();

                for (var i = 0; i < totalItems; ++i)
                {
                    Assert.NotNull(await controller.Add(AuthorizedKeyTests.CreateInput()));
                }

                var query  = new AuthorizedKeyQuery();
                var result = await controller.List(query);

                Assert.Equal(query.Limit, result.Limit);
                Assert.Equal(query.Offset, result.Offset);
                Assert.Equal(3, result.Total);
                Assert.NotEmpty(result.Items);
            }
 async Task AddRange()
 {
     var repo = mockup.Get <IAuthorizedKeyRepository>();
     await repo.AddRange(new AuthorizedKeyInput[] { AuthorizedKeyTests.CreateInput(), AuthorizedKeyTests.CreateInput(), AuthorizedKeyTests.CreateInput() });
 }