示例#1
0
            public void Inheritence()
            {
                var request = new GetAllPlatformsRequest(FakeRepository, FakeRepositoryAggregate);

                request.Should().NotBeNull();
                request.Should().BeAssignableTo <IGetAllPlatformsRequest>();
                request.Should().BeAssignableTo <BaseServiceRequest <Domain.Platform.Entities.Platform> >();
                request.Should().BeOfType <GetAllPlatformsRequest>();
            }
示例#2
0
            public void Execute()
            {
                Expression <Func <IEnumerable <Domain.Platform.Entities.Platform> > > getAll = () => FakeRepository.GetAll();

                var platforms = TestData.GetPlatforms().ToArray();

                A.CallTo(getAll).Returns(platforms);

                var request = new GetAllPlatformsRequest(FakeRepository, FakeRepositoryAggregate);

                request.Should().NotBeNull();

                var response = request.Execute();

                response.Should().NotBeNull();
                response.Should().BeOfType <PlatformListResponse>();

                response.Platforms.Should().NotBeNullOrEmpty();

                //platform 1 result
                var nes = response.Platforms.ElementAt(0);

                CheckValues(nes, platforms.Single(p => p.Id == 1));

                //platform 2 result
                var snes = response.Platforms.ElementAt(1);

                CheckValues(snes, platforms.Single(p => p.Id == 2));

                void CheckValues(IPlatform platform, IPlatform expected)
                {
                    platform.Should().NotBeNull();
                    platform.Id.Should().Be(expected.Id);
                    platform.Name.Should().BeEquivalentTo(expected.Name);
                    platform.ReleaseDate.Should().Be(expected.ReleaseDate);
                }

                A.CallTo(getAll).MustHaveHappened(Repeated.Exactly.Once);
            }
示例#3
0
 public void TestInitalize()
 {
     InitializeFakes();
     getAll  = () => FakeRepository.GetAll();
     request = new GetAllPlatformsRequest(FakeRepository, FakeRepositoryAggregate);
 }