﻿using System;
using Xunit;

namespace NetChris.Security.Tests.PasswordHash
{
    public class Instantiation
    {
        public class With_null_algorithmIdentifier
        {
            [Fact]
            public void Throws_ArgumentNullException()
            {
                Assert.Throws<ArgumentNullException>(
                    () =>
                        new Cryptography.PasswordHash(null, new byte[10], new byte[10], TimeSpan.FromMilliseconds(500)));
            }
        }

        public class With_empty_algorithmIdentifier
        {
            [Fact]
            public void Throws_ArgumentOutOfRangeException()
            {
                Assert.Throws<ArgumentOutOfRangeException>(
                    () =>
                        new Cryptography.PasswordHash(string.Empty, new byte[10], new byte[10], TimeSpan.FromMilliseconds(500)));
            }
        }

        public class With_null_hash
        {
            [Fact]
            public void Throws_ArgumentNullException()
            {
                Assert.Throws<ArgumentNullException>(
                    () =>
                        new Cryptography.PasswordHash("AnAlgorithm", null, new byte[10], TimeSpan.FromMilliseconds(500)));
            }
        }

        public class With_null_salt
        {
            [Fact]
            public void Throws_ArgumentNullException()
            {
                Assert.Throws<ArgumentNullException>(
                    () =>
                        new Cryptography.PasswordHash("AnAlgorithm", new byte[10], null, TimeSpan.FromMilliseconds(500)));
            }
        }
    }
}
