Example #1
0
        public void GivenIHaveADomainClass()
        {
            var myDto = new TestDomainClass
            {
                Property1 = 500,
                Property2 = "This is a string",
                Property3 = 48.2M,
            };

            this.scenarioContext.Set(myDto);
        }
Example #2
0
        public void ThenThePropertiesOfTheOriginalDocumentShouldBePresentInTheDeserializedDocument()
        {
            HalDocument     result = this.scenarioContext.Get <HalDocument>();
            TestDomainClass dtoIn  = this.scenarioContext.Get <TestDomainClass>();

            Assert.IsTrue(result.TryGetProperties(out TestDomainClass? dtoOut));

            Assert.AreEqual(dtoIn.Property1, dtoOut !.Property1);
            Assert.AreEqual(dtoIn.Property2, dtoOut.Property2);
            Assert.AreEqual(dtoIn.Property3, dtoOut.Property3);
        }
Example #3
0
        public void ThenThePropertiesOfTheDomainClassShouldBeSerializedAsTopLevelPropertiesInTheJSON()
        {
            JObject         result = this.scenarioContext.Get <JObject>();
            TestDomainClass dto    = this.scenarioContext.Get <TestDomainClass>();

            Assert.NotNull(result["property1"]);
            Assert.NotNull(result["property2"]);
            Assert.NotNull(result["property3"]);

            Assert.AreEqual(dto.Property1, result["property1"].Value <int>());
            Assert.AreEqual(dto.Property2, result["property2"].Value <string>());
            Assert.AreEqual(dto.Property3, result["property3"].Value <decimal>());
        }
Example #4
0
        public void FakeServiceLayer_GetById()
        {
            // arrange
            var expected = new TestDomainClass();

            SystemUnderTest.GetByIdReturnValue = expected;

            // act
            var actual = SystemUnderTest.GetById(1234);

            // assert
            Assert.AreEqual <TestDomainClass>(expected, actual, "Wrong value");
            Assert.IsTrue(SystemUnderTest.WasGetByIdCalled, "Method wasn't called");
        }
Example #5
0
        public void FakeServiceLayer_Save()
        {
            // arrange
            var saveThis = new TestDomainClass();

            // act
            SystemUnderTest.Save(saveThis);

            // assert
            Assert.AreEqual <TestDomainClass>(
                saveThis,
                SystemUnderTest.SaveArgumentValue,
                "Save argument value was wrong.");

            Assert.IsTrue(SystemUnderTest.WasSaveCalled, "Method wasn't called");
        }