mardi 7 mars 2017

What should be the appropriate nunit test case for the following code snippet?

The following function is used to check if the play operation is possible or not returns true if play is possible else false. What should be the appropriate nunit test case for this method.

     private bool CanPlay(object parameter)
    {
        if (AudioEngine != null)
        {
            return AudioEngine.CanPlay;
        }
        return false;
    }
    private void Play(object parameter)
    {
        if (AudioEngine != null && AudioEngine.ActiveStream!=null)
        {
            AudioEngine.Play();
        }
    }
    [Test]
    public void PlayAudioControlVMTestTrue()
    {
        AudioControlVm avm = new AudioControlVm();
        RelayCommand command = (RelayCommand)avm.PlayCommand;
        bool canPlay = command.CanExecute(avm);
        Assert.IsTrue(canPlay); 
    }

Aucun commentaire:

Enregistrer un commentaire