public void DeleteSpeaker_With_Specified_Id_Successfully()
        {
            //act
            var speakerName = "TEST";
            var sample      = File.ReadAllBytes("test.wav");

            var samples = new List <byte[]>()
            {
                sample
            };

            IUnitOfWork unitOfWork = CreateUnitOfWork();
            var         sut        = new SpeakerRecignitionService(unitOfWork);

            sut.AddVoiceSamples(speakerName, samples);

            //arrange
            sut.DeleteSpeaker(_speakers.First().Id);

            //assert
            _speakers
            .Should()
            .NotBeNull();

            _speakers
            .Should()
            .HaveCount(0);
        }
        public void GetSpeakers_With_Specified_Sample_Successfully()
        {
            //act
            var speakerName = "TEST";
            var sample      = File.ReadAllBytes("test.wav");

            var samples = new List <byte[]>()
            {
                sample
            };

            IUnitOfWork unitOfWork = CreateUnitOfWork();
            var         sut        = new SpeakerRecignitionService(unitOfWork);

            sut.AddVoiceSamples(speakerName, samples);

            //arrange
            var result = sut.GetSpeakers();

            //assert
            result
            .Should()
            .NotBeNull();

            result
            .Should()
            .BeEquivalentTo(_speakers);
        }
        public void Construct_With_Unit_Of_Work_Sucessfully()
        {
            //act
            IUnitOfWork unitOfWork = CreateUnitOfWork();

            //arrange
            Action action = () => { var sut = new SpeakerRecignitionService(unitOfWork); };

            //assert
            action
            .Should()
            .NotThrow <ArgumentException>();
        }
        public void Construct_With_Null_Unit_Of_Work_Throw_Excepion()
        {
            //act
            IUnitOfWork unitOfWork = null;

            //arrange
            Action action = () => { var sut = new SpeakerRecignitionService(unitOfWork); };

            //assert
            action
            .Should()
            .Throw <ArgumentException>();
        }
        public void AddVoiceSamples_Adds_Speaker_Sample_Successfully()
        {
            //act
            var speakerName = "TEST";
            var samples     = new List <byte[]>()
            {
                File.ReadAllBytes("test.wav")
            };

            var comparisonCore = ComparisonCore.Instance;

            IUnitOfWork unitOfWork = CreateUnitOfWork();
            var         sut        = new SpeakerRecignitionService(unitOfWork);

            //arrange
            sut.AddVoiceSamples(speakerName, samples);

            //assert
            comparisonCore.Speakers
            .Should()
            .NotBeNull();

            comparisonCore.Speakers
            .Should()
            .NotBeEmpty();

            comparisonCore.Speakers
            .Should()
            .HaveCount(1);

            comparisonCore.Speakers.First().Name
            .Should()
            .Be(speakerName);

            _speakers
            .Should()
            .NotBeNull();

            _speakers
            .Should()
            .NotBeEmpty();

            _speakers
            .Should()
            .HaveCount(1);

            _speakers.First().Name
            .Should()
            .Be(speakerName);
        }
        public void DeleteSpeaker_With_Empty_Id_Throws_Exception()
        {
            //act
            var id = string.Empty;

            IUnitOfWork unitOfWork = CreateUnitOfWork();
            var         sut        = new SpeakerRecignitionService(unitOfWork);

            //arrange
            Action action = () => sut.DeleteSpeaker(id);

            //assert
            action
            .Should()
            .Throw <ArgumentNullException>();
        }
        public void RecognizeSpeaker_With_Empty_Samples_Throw_Excepion()
        {
            //act
            byte[] sample = new byte[0];

            IUnitOfWork unitOfWork = CreateUnitOfWork();
            var         sut        = new SpeakerRecignitionService(unitOfWork);

            //arrange
            Action action = () => { sut.RecognizeSpeaker(sample); };

            //assert
            action
            .Should()
            .Throw <ArgumentException>();
        }
        public void AddVoiceSamples_With_Empty_Samples_Throw_Excepion()
        {
            //act
            var speakerName = "TEST";
            var samples     = new List <byte[]>();

            IUnitOfWork unitOfWork = CreateUnitOfWork();
            var         sut        = new SpeakerRecignitionService(unitOfWork);

            //arrange
            Action action = () => { sut.AddVoiceSamples(speakerName, samples); };

            //assert
            action
            .Should()
            .Throw <ArgumentException>();
        }