예제 #1
0
            public void Should_Return_The_Folder_Passed_As_Argument()
            {
                // Given
                var service = new AutoAddServiceFixture().CreateAutoAddService();

                // When
                var folder = service.CreateFolder(new Folder {Path = "<some path>"});

                // Then
                Assert.Equal("<some path>", folder.Path);
            }
예제 #2
0
            public void Should_Throw_Exception_If_Folder_Is_Null()
            {
                // Given
                var service = new AutoAddServiceFixture().CreateAutoAddService();

                // When
                var exception = Record.Exception(() => service.UpdateFolder(null));

                // Then
                Assert.IsType<ArgumentNullException>(exception);
                Assert.Equal("folder", ((ArgumentNullException)exception).ParamName);
            }
예제 #3
0
            public void Should_Return_An_Empty_List_If_Repository_Is_Null()
            {
                // Given
                var fixture = new AutoAddServiceFixture();
                fixture.AutoAddRepository.GetFolders().Returns(info => null);
                var service = fixture.CreateAutoAddService();

                // When
                var result = service.GetFolders();

                // Then
                Assert.Equal(Enumerable.Empty<Folder>(), result);
            }
예제 #4
0
            public void Should_Return_An_List_Of_Folders()
            {
                // Given
                var fixture = new AutoAddServiceFixture();
                fixture.AutoAddRepository.GetFolders().Returns(info => new[] {new Folder()});
                var service = fixture.CreateAutoAddService();

                // When
                var result = service.GetFolders();

                // Then
                Assert.Equal(1, result.Count());
            }