예제 #1
0
        public void NoSoSuperComputer()
        {
            //StringBuilder str = new StringBuilder();

            //str.Append("hello");
            //str.Append(' ');
            //str.Append("world");

            //Assert.IsTrue(str.ToString() == "hello world");

            var computer = new Computer
            {
                AmountOfCores = 1,
                AmountOfRam   = 2,
                CpuFrequency  = 2.0m,
                DriveType     = "hdd"
            };

            var store   = new HandyDandyComputerStore();
            var builder = new NotSoSuperComputerBuilder();

            store.Build(builder);

            builder.SetCores();
            builder.SetRam();
            builder.SetCpuFrequency();
            builder.SetDriveType();

            var superComputer = builder.GetComputer();

            Assert.AreEqual(superComputer.AmountOfCores, computer.AmountOfCores);
            Assert.AreEqual(superComputer.AmountOfRam, computer.AmountOfRam);
            Assert.AreEqual(superComputer.CpuFrequency, computer.CpuFrequency);
            Assert.AreEqual(superComputer.DriveType, computer.DriveType);
        }
예제 #2
0
        public void NoSoSuperComputer()
        {
            var computer = new Computer
            {
                AmountOfCores = 1,
                AmountOfRam   = 2,
                CpuFrequency  = 2.0m,
                DriveType     = "hdd"
            };

            var store   = new HandyDandyComputerStore();
            var builder = new NotSoSuperComputerBuilder();

            builder.SetCores();
            builder.SetCpuFrequency();
            builder.SetRam();
            builder.SetDriveType();

            var superComputer = store.Build(builder);

            Assert.AreEqual(computer.AmountOfRam, superComputer.AmountOfRam);
            Assert.AreEqual(computer.AmountOfCores, superComputer.AmountOfCores);
            Assert.AreEqual(computer.CpuFrequency, superComputer.CpuFrequency);
            Assert.AreEqual(computer.DriveType, superComputer.DriveType);
        }