예제 #1
0
        public void TestThatGetDataCallsIsActivatedOnHouseholdMember()
        {
            var fixture = new Fixture();
            var householdDataRepositoryMock = MockRepository.GenerateMock <IHouseholdDataRepository>();
            var claimValueProviderMock      = MockRepository.GenerateMock <IClaimValueProvider>();
            var objectMapperMock            = MockRepository.GenerateMock <IFoodWasteObjectMapper>();

            var householdMemberMock = DomainObjectMockBuilder.BuildHouseholdMemberMock();

            var householdMemberIsActivatedQueryHandler = new HouseholdMemberIsActivatedQueryHandler(householdDataRepositoryMock, claimValueProviderMock, objectMapperMock);

            Assert.That(householdMemberIsActivatedQueryHandler, Is.Not.Null);

            householdMemberIsActivatedQueryHandler.GetData(householdMemberMock, fixture.Create <HouseholdMemberIsActivatedQuery>(), DomainObjectMockBuilder.BuildTranslationInfoMock());

            householdMemberMock.AssertWasCalled(m => m.IsActivated);
        }
예제 #2
0
        public void TestThatGetDataReturnsValueFromIsActivatedOnHouseholdMember(bool isActivated)
        {
            var fixture = new Fixture();
            var householdDataRepositoryMock = MockRepository.GenerateMock <IHouseholdDataRepository>();
            var claimValueProviderMock      = MockRepository.GenerateMock <IClaimValueProvider>();
            var objectMapperMock            = MockRepository.GenerateMock <IFoodWasteObjectMapper>();

            var householdMemberMock = DomainObjectMockBuilder.BuildHouseholdMemberMock(isActivated: isActivated);

            var householdMemberIsActivatedQueryHandler = new HouseholdMemberIsActivatedQueryHandler(householdDataRepositoryMock, claimValueProviderMock, objectMapperMock);

            Assert.That(householdMemberIsActivatedQueryHandler, Is.Not.Null);

            var result = householdMemberIsActivatedQueryHandler.GetData(householdMemberMock, fixture.Create <HouseholdMemberIsActivatedQuery>(), DomainObjectMockBuilder.BuildTranslationInfoMock());

            Assert.That(result, Is.EqualTo(isActivated));
        }
예제 #3
0
        public void TestThatGetDataThrowsArgumentNullExceptionWhenHouseholdMemberIsNull()
        {
            var fixture = new Fixture();
            var householdDataRepositoryMock = MockRepository.GenerateMock <IHouseholdDataRepository>();
            var claimValueProviderMock      = MockRepository.GenerateMock <IClaimValueProvider>();
            var objectMapperMock            = MockRepository.GenerateMock <IFoodWasteObjectMapper>();

            var householdMemberIsActivatedQueryHandler = new HouseholdMemberIsActivatedQueryHandler(householdDataRepositoryMock, claimValueProviderMock, objectMapperMock);

            Assert.That(householdMemberIsActivatedQueryHandler, Is.Not.Null);

            var exception = Assert.Throws <ArgumentNullException>(() => householdMemberIsActivatedQueryHandler.GetData(null, fixture.Create <HouseholdMemberIsActivatedQuery>(), DomainObjectMockBuilder.BuildTranslationInfoMock()));

            Assert.That(exception, Is.Not.Null);
            Assert.That(exception.ParamName, Is.Not.Null);
            Assert.That(exception.ParamName, Is.Not.Empty);
            Assert.That(exception.ParamName, Is.EqualTo("householdMember"));
            Assert.That(exception.InnerException, Is.Null);
        }