Пример #1
0
        public void Test_Constructor_Null_Owner_Throws_Exception()
        {
            // ARRANGE
            Guid         paramGuid            = Guid.NewGuid();
            const int    paramLowBoardNumber  = 1;
            const int    paramHighBoardNumber = 32;
            const string paramDescription     = "Blue";

            ISetPurpose paramSetPurpose = new SetPurpose(
                id: Guid.NewGuid(),
                code: "EVENT",
                name: "Events");

            ISetColour paramSetColour = new SetColour(
                id: Guid.NewGuid(),
                code: "LT-BLUE",
                name: "Light Blue");

            // ACT
            _ = new Set(
                id: paramGuid,
                lowBoardNumber: paramLowBoardNumber,
                highBoardNumber: paramHighBoardNumber,
                description: paramDescription,
                owner: null,
                setPurpose: paramSetPurpose,
                setColour: paramSetColour);
        }
Пример #2
0
        public void Test_Constructor_Null_Set_Colour_Throws_Exception()
        {
            // ARRANGE
            Guid         paramGuid            = Guid.NewGuid();
            const int    paramLowBoardNumber  = 1;
            const int    paramHighBoardNumber = 32;
            const string paramDescription     = "Blue";

            IOwner paramOwner = new Owner(
                id: Guid.NewGuid(),
                code: "BRADGATE",
                name: "Bradgate",
                isClub: true);

            ISetPurpose paramSetPurpose = new SetPurpose(
                id: Guid.NewGuid(),
                code: "EVENT",
                name: "Events");

            // ACT
            _ = new Set(
                id: paramGuid,
                lowBoardNumber: paramLowBoardNumber,
                highBoardNumber: paramHighBoardNumber,
                description: paramDescription,
                owner: paramOwner,
                setPurpose: paramSetPurpose,
                setColour: null);
        }
Пример #3
0
        public void Test_Constructor_Empty_Description_Throws_Exception()
        {
            // ARRANGE
            Guid      paramGuid            = Guid.NewGuid();
            const int paramLowBoardNumber  = 1;
            const int paramHighBoardNumber = 32;

            IOwner paramOwner = new Owner(
                id: Guid.NewGuid(),
                code: "BRADGATE",
                name: "Bradgate",
                isClub: true);

            ISetPurpose paramSetPurpose = new SetPurpose(
                id: Guid.NewGuid(),
                code: "EVENT",
                name: "Events");

            ISetColour paramSetColour = new SetColour(
                id: Guid.NewGuid(),
                code: "LT-BLUE",
                name: "Light Blue");

            // ACT
            _ = new Set(
                id: paramGuid,
                lowBoardNumber: paramLowBoardNumber,
                highBoardNumber: paramHighBoardNumber,
                description: string.Empty,
                owner: paramOwner,
                setPurpose: paramSetPurpose,
                setColour: paramSetColour);
        }
Пример #4
0
        public void Test_Constructor_Null_Name_Throws_Exception()
        {
            // ARRANGE
            Guid         paramGuid = Guid.NewGuid();
            const string paramCode = "TEACHING";

            // ACT
            _ = new SetPurpose(
                id: paramGuid,
                code: paramCode,
                name: null);

            // ASSERT
            Assert.Fail();
        }
Пример #5
0
        public void Test_Set_Constructor()
        {
            // ARRANGE
            Guid         paramGuid            = Guid.NewGuid();
            const int    paramLowBoardNumber  = 1;
            const int    paramHighBoardNumber = 32;
            const string paramDescription     = "Blue";

            IOwner paramOwner = new Owner(
                id: Guid.NewGuid(),
                code: "BRADGATE",
                name: "Bradgate",
                isClub: true);

            ISetPurpose paramSetPurpose = new SetPurpose(
                id: Guid.NewGuid(),
                code: "EVENT",
                name: "Events");

            ISetColour paramSetColour = new SetColour(
                id: Guid.NewGuid(),
                code: "LT-BLUE",
                name: "Light Blue");

            ISet set = new Set(
                id: paramGuid,
                lowBoardNumber: paramLowBoardNumber,
                highBoardNumber: paramHighBoardNumber,
                description: paramDescription,
                owner: paramOwner,
                setPurpose: paramSetPurpose,
                setColour: paramSetColour);

            // ACT
            ISet newSet = new Set(set);

            // ASSERT
            Assert.AreEqual(set.Id, newSet.Id);
            Assert.AreEqual(set.LowBoardNumber, newSet.LowBoardNumber);
            Assert.AreEqual(set.HighBoardNumber, newSet.HighBoardNumber);
            Assert.AreEqual(set.Description, newSet.Description);
            Assert.AreSame(set.Owner, newSet.Owner);
            Assert.AreSame(set.SetPurpose, newSet.SetPurpose);
            Assert.AreSame(set.SetColour, newSet.SetColour);
        }
Пример #6
0
        public void Test_Basic_Constructor()
        {
            // ARRANGE
            Guid         paramGuid = Guid.NewGuid();
            const string paramCode = "TEACHING";
            const string paramName = "Teaching";

            // ACT
            ISetPurpose suit = new SetPurpose(
                id: paramGuid,
                code: paramCode,
                name: paramName);

            // ASSERT
            Assert.AreEqual(paramGuid, suit.Id);
            Assert.AreEqual(paramCode, suit.Code);
            Assert.AreEqual(paramName, suit.Name);
        }
Пример #7
0
        public void Test_Constructor_Zero_Low_Board_Number_Greater_Than_High_Board_Number_Throws_Exception()
        {
            // ARRANGE
            Guid         paramGuid            = Guid.NewGuid();
            const int    paramLowBoardNumber  = 32;
            const int    paramHighBoardNumber = 1;
            const string paramDescription     = "Blue";

            IOwner paramOwner = new Owner(
                id: Guid.NewGuid(),
                code: "BRADGATE",
                name: "Bradgate",
                isClub: true);

            ISetPurpose paramSetPurpose = new SetPurpose(
                id: Guid.NewGuid(),
                code: "EVENT",
                name: "Events");

            ISetColour paramSetColour = new SetColour(
                id: Guid.NewGuid(),
                code: "LT-BLUE",
                name: "Light Blue");

            // ACT
            _ = new Set(
                id: paramGuid,
                lowBoardNumber: paramLowBoardNumber,
                highBoardNumber: paramHighBoardNumber,
                description: paramDescription,
                owner: paramOwner,
                setPurpose: paramSetPurpose,
                setColour: paramSetColour);

            // ASSERT
            Assert.Fail();
        }
Пример #8
0
        /// <inheritdoc/>
        public void SetPurposes(ICaller caller)
        {
            using IDealData data = InstanceFactory.GetInstance <IDealData>();

            if (data.AnySetPurpose())
            {
                return;
            }

            IDictionary <string, string> setPurposeDetails = new Dictionary <string, string>
            {
                { "TEACHING", "Teaching" },
                { "EVENTS", "Events" }
            };

            foreach (KeyValuePair <string, string> setPurposeDetail in setPurposeDetails)
            {
                ISetPurpose setPurpose = new SetPurpose(
                    id: Guid.NewGuid(),
                    code: setPurposeDetail.Key,
                    name: setPurposeDetail.Value);
                data.CreateSetPurpose(setPurpose);
            }
        }