Beispiel #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);
        }
Beispiel #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);
        }
        public void SuperComputer()
        {
            var computer = new Computer
            {
                AmountOfCores = 64,
                AmountOfRam   = 256,
                CpuFrequency  = 3.4m,
                DriveType     = "ssd"
            };

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

            var superComputer = store.Build(builder);

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

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

            var notSoSuperComputer = store.Build(builder);

            Assert.AreEqual(computer.AmountOfCores, notSoSuperComputer.AmountOfCores);
            Assert.AreEqual(computer.AmountOfRam, notSoSuperComputer.AmountOfRam);
            Assert.AreEqual(computer.CpuFrequency, notSoSuperComputer.CpuFrequency);
            Assert.AreEqual(computer.DriveType, notSoSuperComputer.DriveType);
        }
        public void BuilderTests_IsEqualComputerObjectAndSuperComputerBuilderObjectWithTheSameSpecs_ReturnTrue()
        {
            var computer = new Computer
            {
                AmountOfCores = 64,
                AmountOfRam   = 256,
                CpuFrequency  = 3.4m,
                DriveType     = "ssd"
            };

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

            var superComputer = store.Build(builder);

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