예제 #1
0
        public void Bin_OpenFileAndGatInformation_FileNotExist_FileNotFoundException()
        {
            string        Path       = @"Lala.txt";
            var           fileSystem = new MockFileSystem();
            IWorkWithFile file       = new FileWriterBin(fileSystem, Path);

            Assert.Throws <FileNotFoundException>(() => file.OpenFileAndGatInformation());
        }
예제 #2
0
        public void Bin_CreateSaveDownload_CreateClassSaveItAndDownloadFromFile_True()
        {
            IPlaygroundArray expectedArray = new PlaygroundArray(10, 10, 1);
            string           Path          = @"Resurses\MyTest.bin";
            var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { Path, "" }
            });
            IWorkWithFile file = new FileWriterBin(fileSystem, Path);

            file.WriteInformationInFile(expectedArray);
            IPlaygroundArray actualArray = file.OpenFileAndGatInformation();

            Assert.Equal(expectedArray.NumberOfArrays,
                         actualArray.NumberOfArrays);
            Assert.Equal(expectedArray.PlaygroundArrays[0].IterationNumber,
                         actualArray.PlaygroundArrays[0].IterationNumber);
            Assert.Equal(expectedArray.PlaygroundArrays[0].GetNumberOfLivePoints(),
                         actualArray.PlaygroundArrays[0].GetNumberOfLivePoints());
            Assert.Equal(expectedArray.PlaygroundArrays[0].GetPlaygroundArray(),
                         actualArray.PlaygroundArrays[0].GetPlaygroundArray());
        }