Ejemplo n.º 1
0
        public void TestSelectAttachment()
        {
            //arrange
            var fileListingName           = "C:\\";
            var fileChildListingName      = "someName2";
            var fileGrandChildListingName = "someName2";
            var name            = fileListingName + fileChildListingName + "\\" + fileGrandChildListingName;
            var fileListingMock = new Mock <IFileListingModel>();

            fileListingMock.SetupGet(it => it.Name).Returns(fileListingName);
            var fileChildListingMock = new Mock <IFileListingModel>();

            fileChildListingMock.SetupGet(it => it.Name).Returns(fileChildListingName);
            fileListingMock.SetupGet(it => it.Children)
            .Returns(new ObservableCollection <IFileListingModel>()
            {
                fileChildListingMock.Object
            });
            var fileGrandChildListingMock = new Mock <IFileListingModel>();

            fileGrandChildListingMock.SetupGet(it => it.Name).Returns(fileGrandChildListingName);
            fileChildListingMock.SetupGet(it => it.Children)
            .Returns(new ObservableCollection <IFileListingModel>()
            {
                fileGrandChildListingMock.Object
            });
            var model = new List <IFileListingModel>()
            {
                fileListingMock.Object
            };

            //act
            _target.SelectAttachment(name, model);

            //assert
            fileListingMock.VerifySet(it => it.IsExpanded          = true);
            fileChildListingMock.VerifySet(it => it.IsExpanded     = true);
            fileGrandChildListingMock.VerifySet(it => it.IsChecked = true);
        }