public static IEnumerable <object[]> UsuariosIndexarParametrosTest()
        {
            var listaUser = new List <Core.Entity.UserAlbum.UserAlbum>()
            {
                UtilUserAlbum.ObterUserAlbum()
            };

            yield return(new object[]
            {
                new Dictionary <ulong, string>(),
                listaUser,
                1
            });

            yield return(new object[]
            {
                null,
                listaUser,
                1
            });

            yield return(new object[]
            {
                new Dictionary <ulong, string>
                {
                    { 1, "hashTeste" },
                },
                listaUser,
                1
            });

            yield return(new object[]
            {
                new Dictionary <ulong, string>
                {
                    { 1, "hashTeste" },
                    { 2, "hashTeste" },
                    { 3, "hashTeste" },
                },
                null,
                0
            });

            yield return(new object[]
            {
                null,
                new List <Core.Entity.UserAlbum.UserAlbum>(),
                0
            });
        }
        public static IEnumerable <object[]> UsuariosDesindexarParametrosTest()
        {
            yield return(new object[]
            {
                new Dictionary <ulong, string>(),
                new List <Core.Entity.UserAlbum.UserAlbum>()
                {
                    UtilUserAlbum.ObterUserAlbum()
                },
                0
            });

            yield return(new object[]
            {
                null,
                new List <Core.Entity.UserAlbum.UserAlbum>()
                {
                    UtilUserAlbum.ObterUserAlbum()
                },
                0
            });

            yield return(new object[]
            {
                new Dictionary <ulong, string>
                {
                    { 90, "hashTeste" },
                    { 91, "hashTeste" },
                    { 92, "hashTeste" },
                },
                new List <Core.Entity.UserAlbum.UserAlbum>()
                {
                    UtilUserAlbum.ObterUserAlbum()
                },
                3
            });

            yield return(new object[]
            {
                new Dictionary <ulong, string>
                {
                    { 1, "hashTeste" },
                    { 2, "hashTeste" },
                    { 3, "hashTeste" },
                },
                null,
                3
            });
        }
Пример #3
0
        public void CalcularHash_AlterandoOrdenacao_Test()
        {
            var user = UtilUserAlbum.ObterUserAlbum();

            user.CalcularHash();
            var hash1 = user.Hash;

            UtilUserAlbum.EmbaralharLista(user.Albums);
            for (var i = 0; i < user.Albums.Count; i++)
            {
                UtilUserAlbum.EmbaralharLista(user.Albums[i].Photos);
            }

            user.CalcularHash();
            var hash2 = user.Hash;

            Assert.Equal(hash1, hash2);
        }
Пример #4
0
        public void CalcularHash_AlterandoUrlFoto_Test()
        {
            var rng = new Random();

            var user = UtilUserAlbum.ObterUserAlbum();

            user.CalcularHash();
            var hash1 = user.Hash;

            var indexAlbum = rng.Next(user.Albums.Count);
            var indexFoto  = rng.Next(user.Albums[indexAlbum].Photos.Count);

            user.Albums[indexAlbum].Photos[indexFoto].Url = "http://urlalterada";

            user.CalcularHash();
            var hash2 = user.Hash;

            Assert.NotEqual(hash1, hash2);
        }
Пример #5
0
        public void CalcularHash_RemovendoFoto_Test()
        {
            var rng = new Random();

            var user = UtilUserAlbum.ObterUserAlbum();

            user.CalcularHash();
            var hash1 = user.Hash;

            var indexAlbum = rng.Next(user.Albums.Count);
            var indexFoto  = rng.Next(user.Albums[indexAlbum].Photos.Count);

            user.Albums[indexAlbum].Photos.RemoveAt(indexFoto);

            user.CalcularHash();
            var hash2 = user.Hash;

            Assert.NotEqual(hash1, hash2);
        }