示例#1
0
        public async Task TestIfGetAdminLayoutInformationThrowsError(string username)
        {
            var context = PCHUBDbContextInMemoryInitializer.InitializeContext();

            var adminLayoutService = new Areas.Administration.Services.AdminLayoutServices(context);

            await Assert.ThrowsAsync <NullReferenceException>(async() =>
            {
                await adminLayoutService.GetAdminLayoutInformationAsync(username);
            });
        }
示例#2
0
        public async Task TestIfGetAdminLayoutInformationWorksAccordingly(string username)
        {
            var context = PCHUBDbContextInMemoryInitializer.InitializeContext();

            var adminLayoutService = new Areas.Administration.Services.AdminLayoutServices(context);

            await context.Users.AddAsync(new User
            {
                UserName = username,
                Email    = username,
            });

            await context.SaveChangesAsync();

            var result = await adminLayoutService.GetAdminLayoutInformationAsync(username);

            Assert.Equal(username, result.Username);
            Assert.Equal("https://dndf.business/wp-content/uploads/2014/07/765-default-avatar-530x500.png", result.PictureUrl);
        }