Ejemplo n.º 1
0
        public void ExplorerItemFactory_GetDuplicatedResourcesPaths_ShouldReturnDuplicateStringMessage()
        {
            const string expectedResults = "Resource Test_Resource in path Test_path and path Test_path2 are the same";
            var          catalogue       = new Mock <IResourceCatalog>();
            var          directory       = new Mock <IDirectory>();
            var          auth            = new Mock <IAuthorizationService>();

            //------------Setup for test--------------------------
            catalogue.Setup(catalog => catalog.GetDuplicateResources())
            .Returns(new List <DuplicateResource>
            {
                new DuplicateResource
                {
                    ResourcePath = new List <string> {
                        "Test_path", "Test_path2"
                    }
                    ,
                    ResourceName = "Test_Resource"
                    ,
                    ResourceId = Guid.NewGuid()
                }
            });
            //------------Execute Test---------------------------
            var explorerItemFactory = new ExplorerItemFactory(catalogue.Object, directory.Object, auth.Object);

            Assert.IsNotNull(explorerItemFactory);
            var results = explorerItemFactory.GetDuplicatedResourcesPaths();

            //------------Assert Results-------------------------
            Assert.IsFalse(results.Count == 0);
            Assert.IsFalse(string.Equals(expectedResults, results.Any().ToString()));
        }
Ejemplo n.º 2
0
        public void ExplorerItemFactory_GivenEmptyResourceDir_GetDuplicatedResourcesPaths_ShouldReturnEmptyString()
        {
            var catalogue = new Mock <IResourceCatalog>();
            var directory = new Mock <IDirectory>();
            var auth      = new Mock <IAuthorizationService>();
            //------------Setup for test--------------------------
            //------------Execute Test---------------------------
            var explorerItemFactory = new ExplorerItemFactory(catalogue.Object, directory.Object, auth.Object);

            Assert.IsNotNull(explorerItemFactory);
            var results = explorerItemFactory.GetDuplicatedResourcesPaths();

            //------------Assert Results-------------------------
            Assert.AreEqual(0, results.Count);
        }