Ejemplo n.º 1
0
        public void TestSetup()
        {
            m_disk             = new MockDiskImage();
            m_disk.Files["P0"] = new MockImageFile(System.IO.File.ReadAllBytes("data\\p3.prg"));

            m_data = new Ultima1CharacterData();

            m_data.Load(m_disk, 0);
        }
        public void UnableToLoadThrowsError()
        {
            MockDiskImage image = new MockDiskImage();

            image.LoadReturnValue = false;

            Ultima1Data data = new Ultima1Data(image);

            data.Load("blah");
        }
        public void NoSaveWithoutLoad()
        {
            MockDiskImage image = new MockDiskImage();

            image.Files["P0"] = new MockImageFile(System.IO.File.ReadAllBytes("data\\p3.prg"));
            image.Files["P2"] = new MockImageFile(System.IO.File.ReadAllBytes("data\\p3.prg"));
            image.Files["P3"] = new MockImageFile(System.IO.File.ReadAllBytes("data\\p3.prg"));

            Ultima1Data data = new Ultima1Data(image);

            data.Save();
        }
        public void SaveFailsToWriteAllBytes()
        {
            MockDiskImage image = new MockDiskImage();

            image.Files["P0"] = new MockImageFile(System.IO.File.ReadAllBytes("data\\p3.prg"));
            image.Files["P0"].MaxBytesToWrite = 400;

            Ultima1Data data = new Ultima1Data(image);

            data.Load("blah");

            data.Save();
        }
        public void PartialDiskLoad()
        {
            MockDiskImage image = new MockDiskImage();

            image.Files["P0"] = new MockImageFile(System.IO.File.ReadAllBytes("data\\p3.prg"));
            image.Files["P2"] = new MockImageFile(System.IO.File.ReadAllBytes("data\\p3.prg"));
            image.Files["P3"] = new MockImageFile(System.IO.File.ReadAllBytes("data\\p3.prg"));

            Ultima1Data data = new Ultima1Data(image);

            data.Load("blah");

            Assert.AreEqual(3, data.NumberOfCharacters);
            Assert.AreEqual("Wolfgang", data.Characters[0].Name);
            Assert.AreEqual("Wolfgang", data.Characters[1].Name);
            Assert.AreEqual("Wolfgang", data.Characters[2].Name);
        }
        public void Save()
        {
            MockDiskImage image = new MockDiskImage();

            image.Files["P0"] = new MockImageFile(System.IO.File.ReadAllBytes("data\\p3.prg"));
            image.Files["P2"] = new MockImageFile(System.IO.File.ReadAllBytes("data\\p3.prg"));
            image.Files["P3"] = new MockImageFile(System.IO.File.ReadAllBytes("data\\p3.prg"));

            Ultima1Data data = new Ultima1Data(image);

            data.Load("blah");

            data.Characters[0].HitPoints = 1234;
            data.Characters[1].HitPoints = 2345;
            data.Characters[2].HitPoints = 3456;

            data.Save();

            data.Dispose();  // Coverage
        }