public async Task ReportUploadError_WhenNullUserIdRecieved()
        {
            var usrmgr = MockUserManager();
            var am     = new UserAvatarManager(new NullLogger <UserAvatarManager>(), usrmgr.Object);
            var avatar = await am.UploadAvatar(null, new byte[999]);

            Assert.False(avatar.Succeeded);
            Assert.Equal("You must provide a user and image to upload an avatar!", avatar.Errors.First().Description);
        }
        public async Task ReportUploadError_WhenNonExistingUserIdRecieved()
        {
            var usrmgr = MockUserManager();
            var am     = new UserAvatarManager(new NullLogger <UserAvatarManager>(), usrmgr.Object);
            var avatar = await am.UploadAvatar(Guid.NewGuid().ToString(), new byte[999]);

            Assert.False(avatar.Succeeded);
            Assert.Equal("Specified user does not exist!", avatar.Errors.First().Description);
        }
        public async Task ReportGetError_WhenNonExistingUserIdRecieved()
        {
            var usrmgr = MockUserManager();
            var am     = new UserAvatarManager(new NullLogger <UserAvatarManager>(), usrmgr.Object);
            var avatar = await am.GetAvatar(Guid.NewGuid().ToString());

            Assert.Null(avatar.ImageData);
            Assert.Equal("Specified user does not exist!", avatar.Errors.First().Description);
        }
        public async Task ReportGetError_WhenNullUserIdRecieved()
        {
            var usrmgr = MockUserManager();
            var am     = new UserAvatarManager(new NullLogger <UserAvatarManager>(), usrmgr.Object);
            var avatar = await am.GetAvatar(null);

            Assert.Null(avatar.ImageData);
            Assert.Equal("You must provide a user id to get an avatar!", avatar.Errors.First().Description);
        }
        public async Task UploadAvatarData_WhenValidUserIdRecieved()
        {
            var usrmgr = MockUserManager();
            var am     = new UserAvatarManager(new NullLogger <UserAvatarManager>(), usrmgr.Object);
            var avatar = await am.UploadAvatar(_testUser.Id, new byte[999]);

            Assert.True(avatar.Succeeded);
            usrmgr.Verify(x => x.UpdateAsync(It.Is <HoundDogUser>(y => y.ProfileAvatar.Length == 999)));
        }
        public async Task GetAvatarData_WhenValidUserIdRecieved()
        {
            var usrmgr = MockUserManager();
            var am     = new UserAvatarManager(new NullLogger <UserAvatarManager>(), usrmgr.Object);
            var avatar = await am.GetAvatar(_testUser.Id);

            Assert.NotNull(avatar.ImageData);
            Assert.Equal(666, avatar.ImageData.Length);
        }
        public async Task ReportUploadError_WhenUpdateFails()
        {
            var usrmgr = MockUserManager();
            var am     = new UserAvatarManager(new NullLogger <UserAvatarManager>(), usrmgr.Object);
            var avatar = await am.UploadAvatar(_testUserFail.Id, new byte[999]);

            Assert.False(avatar.Succeeded);
            Assert.Equal("Fail", avatar.Errors.First().Description);
        }