public void WhenCreateFileItWillReturnCreatedFileInfo()
        {
            var inputFile = new StubIProject();
            var fileCreated = BuildProjectCreator().Create(inputFile);

            Assert.AreEqual(fileCreated, inputFile);
        }
        public void WhenProjectIsValidItWillBeStored()
        {
            var project = new StubIProject();
            var actualProject = new ProjectLoadedEventArgs(project).Project;

            Assert.AreEqual(project, actualProject);
        }
        public void WhenProjectIsLoadedWillSerialize()
        {
            var project = new StubIProject { PathGet = () => @"C:\\" };
            var projectLoader = new StubIProjectLoader { CurrentProjectGet = () => project };
            var spyIXmlSerializer = new SpyIXmlSerializer();
            SetupClass(projectLoader: projectLoader, xmlSerializer: spyIXmlSerializer).Serialize(new List<IItem>());

            Assert.IsTrue(spyIXmlSerializer.SerializeHasBeenCalled);
        }
        public void WhenNewProjectIsLoadedItWillBeAddedToTheViewModel()
        {
            var spyIProjectLoader = new SpyIProjectLoader();
            var stubProject = new StubIProject();
            var projectExplorerItemFactory = new StubIProjectExplorerItemFactory
            {
                CreateIFile = value => new ProjectExplorerItem(value, null)
            };

            var viewModel = SetupClass(projectLoader: spyIProjectLoader,
                projectExplorerItemFactory: projectExplorerItemFactory);

            spyIProjectLoader.RaiseProjectLoadedEvent(stubProject);

            Assert.AreEqual(1, viewModel.Items.Count());
        }
        public void WhenProjectIsLoadedWillReturnItemsCollection()
        {
            var project = new StubIProject();
            var projectLoader = new StubIProjectLoader
            {
                CurrentProjectGet = () => project
            };

            var itemsCollection = new List<IItem> {new StubIItem()};
            var serializableItemCollection = new SerializableItemCollection(itemsCollection);

            var xmlDeserializer = new StubIXmlDeserializer();
            xmlDeserializer.DeserializeOf1String(s => serializableItemCollection);

            var deserializedCollection = SetupClassWithDefaults(projectLoader, xmlDeserializer).Deserialize();

            Assert.AreEqual(itemsCollection.Count, deserializedCollection.Count());
        }